com.jmw.tzap.filters
Class AppendFileFilter

java.lang.Object
  extended by com.jmw.tzap.AbstractFilter
      extended by com.jmw.tzap.IteratingFilter
          extended by com.jmw.tzap.filters.AppendFileFilter

public class AppendFileFilter
extends IteratingFilter

Appends the contents of a file to the beginning or end of a buffer.

Author:
Judah Wischnitzer

Field Summary
protected  java.io.File appendFile
           
protected  java.lang.String appendName
           
protected  boolean atEnd
           
protected  java.lang.StringBuffer text
           
 
Fields inherited from class com.jmw.tzap.AbstractFilter
encoding, MSG_DEBUG, MSG_ERR, MSG_INFO, MSG_VERBOSE, MSG_WARN, task
 
Constructor Summary
AppendFileFilter()
           
 
Method Summary
 java.lang.StringBuffer doFilter(java.lang.StringBuffer sb, java.lang.String fileName)
          Description of the Method
 void setAppendFile(java.lang.String s)
          Sets the name of the file that will be appended.
 void setAtEnd(boolean atEnd)
          Sets the at end flag which indicates whether or not the append string is added at the end or the beginning.
 void unload()
          unloads the filter
 void validateParameters()
          Validates the parameters
 
Methods inherited from class com.jmw.tzap.IteratingFilter
execute, load
 
Methods inherited from class com.jmw.tzap.AbstractFilter
getName, log, log, setEncoding, setTask
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

atEnd

protected boolean atEnd

appendFile

protected java.io.File appendFile

appendName

protected java.lang.String appendName

text

protected java.lang.StringBuffer text
Constructor Detail

AppendFileFilter

public AppendFileFilter()
Method Detail

unload

public void unload()
unloads the filter

Overrides:
unload in class IteratingFilter

doFilter

public java.lang.StringBuffer doFilter(java.lang.StringBuffer sb,
                                       java.lang.String fileName)
Description of the Method

Specified by:
doFilter in class IteratingFilter
Parameters:
sb - the buffer to be filtered
fileName - the name of the file that this buffer is from
Returns:
the filtered buffer

validateParameters

public void validateParameters()
                        throws java.lang.Exception
Validates the parameters

Specified by:
validateParameters in class AbstractFilter
Throws:
java.lang.Exception - if the parameters are invalid

setAppendFile

public void setAppendFile(java.lang.String s)
Sets the name of the file that will be appended.

Parameters:
s - the name of the file to be appended
Throws:
java.io.FileNotFoundException - if the append file is not found

setAtEnd

public void setAtEnd(boolean atEnd)
Sets the at end flag which indicates whether or not the append string is added at the end or the beginning.

Parameters:
atEnd - the at end flag