org.xfp.filters.file
Class FileWriter

java.lang.Object
  extended byorg.xfp.AttributeContainer
      extended byorg.xfp.Filter
          extended byorg.xfp.filters.file.FileWriter

public class FileWriter
extends Filter

Writes input data to a File.

Version:
$Id: FileWriter.java,v 1.1 2004/03/19 15:56:45 flaviotordini Exp $
Author:
Flavio Tordini

Nested Class Summary
 
Nested classes inherited from class org.xfp.Filter
Filter.OnErrorEnum, Filter.OnLoopErrorEnum
 
Field Summary
 
Fields inherited from class org.xfp.AttributeContainer
name, parentContainer
 
Constructor Summary
FileWriter()
           
 
Method Summary
 java.io.File execute(byte[] bytes)
          Executes this filter.
 java.io.File execute(java.io.InputStream inputstream)
          Executes this filter.
 java.io.File execute(java.lang.String string)
          Executes this filter.
 void reset()
          Resets filter status after execution.
 void setAppend(boolean append)
          Sets the append write mode.
 void setEncoding(java.lang.String encoding)
          Sets the character encoding.
 void setFilename(java.lang.String filename)
          Sets the name of the file to write to.
 void setMkdirs(boolean mkdirs)
          If set to true, the filter will create the parent directory of the filename, including any necessary but nonexistent parent directories.
 void setOverwrite(boolean overwrite)
          Sets the wheter to overwrite an existing file.
 
Methods inherited from class org.xfp.Filter
getOnError, initialize, log, newInstance, perform, toString
 
Methods inherited from class org.xfp.AttributeContainer
configureAttributes, disposeAttributes, getAttributes, getFullName, getName, initializeAttributes
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FileWriter

public FileWriter()
Method Detail

setFilename

public void setFilename(java.lang.String filename)
Sets the name of the file to write to.

Parameters:
filename - The name of the file

setMkdirs

public void setMkdirs(boolean mkdirs)
If set to true, the filter will create the parent directory of the filename, including any necessary but nonexistent parent directories. Defaults to the default charset.


setEncoding

public void setEncoding(java.lang.String encoding)
Sets the character encoding. Used only for input types containing characters. Defaults to the system default charset.

Parameters:
encoding - The name of a supported Charset

setAppend

public void setAppend(boolean append)
Sets the append write mode. Defaults to false.

Parameters:
append - if true, then bytes will be written to the end of the file rather than the beginning

execute

public java.io.File execute(java.lang.String string)
                     throws java.lang.Exception
Executes this filter.

Parameters:
string - The String data to write
Returns:
The canonical written file
Throws:
java.lang.Exception

execute

public java.io.File execute(java.io.InputStream inputstream)
                     throws java.lang.Exception
Executes this filter.

Returns:
The canonical written file
Throws:
java.lang.Exception

execute

public java.io.File execute(byte[] bytes)
                     throws java.lang.Exception
Executes this filter.

Returns:
The canonical written file
Throws:
java.lang.Exception

reset

public void reset()
Description copied from class: Filter
Resets filter status after execution. This method is called after execute(), even in case of exceptions. Since a Filter instance may be reused (and actually is), you must use this method to reset all your class members to their default value.

Specified by:
reset in class Filter
See Also:
Filter.reset()

setOverwrite

public void setOverwrite(boolean overwrite)
Sets the wheter to overwrite an existing file. Defaults to false.

Parameters:
overwrite - boolean indicating wheter to overwrite files.


Copyright © 2003-2004 XFP Team. All Rights Reserved.