Openfire 3.6.3 Javadoc

org.jivesoftware.util.log.output.io
Class FileTarget

java.lang.Object
  extended by org.jivesoftware.util.log.output.AbstractTarget
      extended by org.jivesoftware.util.log.output.AbstractOutputTarget
          extended by org.jivesoftware.util.log.output.io.StreamTarget
              extended by org.jivesoftware.util.log.output.io.FileTarget
All Implemented Interfaces:
ErrorAware, LogTarget
Direct Known Subclasses:
RotatingFileTarget

public class FileTarget
extends StreamTarget

A basic target that writes to a File.

Author:
Peter Donald

Constructor Summary
FileTarget(File file, boolean append, Formatter formatter)
          Construct file target to send to a file with a formatter.
 
Method Summary
protected  File getFile()
          Retrieve file associated with target.
protected  void openFile()
          Open underlying file and allocate resources.
protected  void setFile(File file, boolean append)
          Set the file for this target.
 
Methods inherited from class org.jivesoftware.util.log.output.io.StreamTarget
close, setOutputStream, shutdownStream, write
 
Methods inherited from class org.jivesoftware.util.log.output.AbstractOutputTarget
doProcessEvent, getFormatter, open, output, setFormatter
 
Methods inherited from class org.jivesoftware.util.log.output.AbstractTarget
error, getErrorHandler, isOpen, processEvent, setErrorHandler
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileTarget

public FileTarget(File file,
                  boolean append,
                  Formatter formatter)
           throws IOException
Construct file target to send to a file with a formatter.

Parameters:
file - the file to send to
append - true if file is to be appended to, false otherwise
formatter - the Formatter
Throws:
IOException - if an error occurs
Method Detail

setFile

protected void setFile(File file,
                       boolean append)
                throws IOException
Set the file for this target.

Parameters:
file - the file to send to
append - true if file is to be appended to, false otherwise
Throws:
IOException - if directories can not be created or file can not be opened

openFile

protected void openFile()
                 throws IOException
Open underlying file and allocate resources. This method will attempt to create directories below file and append to it if specified.

Throws:
IOException

getFile

protected File getFile()
Retrieve file associated with target. This allows subclasses to access file object.

Returns:
the output File

Openfire 3.6.3 Javadoc

Copyright © 2003-2008 Jive Software.