com.jmw.tzap
Class SplitFilter

java.lang.Object
  extended by com.jmw.tzap.AbstractFilter
      extended by com.jmw.tzap.SplitFilter
Direct Known Subclasses:
SplitByRegexFilter

public abstract class SplitFilter
extends AbstractFilter

Abstract filter for splitting single files into many files.


Field Summary
protected  int count
           
protected  java.lang.String endStr
           
protected  int initialCount
           
protected  int totalCount
           
 
Fields inherited from class com.jmw.tzap.AbstractFilter
encoding, MSG_DEBUG, MSG_ERR, MSG_INFO, MSG_VERBOSE, MSG_WARN, task
 
Constructor Summary
SplitFilter()
           
 
Method Summary
 FilterFile[] execute(FilterFile[] files)
          Executes the filter by sending each file to split().
 void load()
          Does any initilaztion of the filter before it can be used.
 void setCount(int i)
          Sets the count number to be added to all newly created files.
 void setEndString(java.lang.String es)
          Sets the String to be added before the 'count' number.
abstract  java.util.ArrayList<FilterFile> split(FilterFile file)
          Splits a FilterFile into smaller ones.
 void unload()
          Does any clean up after the filter has been finished.
 
Methods inherited from class com.jmw.tzap.AbstractFilter
getName, log, log, setEncoding, setTask, validateParameters
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

count

protected int count

endStr

protected java.lang.String endStr

initialCount

protected int initialCount

totalCount

protected int totalCount
Constructor Detail

SplitFilter

public SplitFilter()
Method Detail

setCount

public void setCount(int i)
Sets the count number to be added to all newly created files. This value defaults to 0.

Parameters:
i - the initial number.

setEndString

public void setEndString(java.lang.String es)
Sets the String to be added before the 'count' number. This value defaults to "", the empty string. For example if the inital file was called text.txt, all split files would be called text#.txt begining with text0.txt, text1.txt etc. The end string allows for the insertion of a string between the name and number. For example and endString of "_" would create files named text_0.txt.

Parameters:
es - the endString.

load

public void load()
Description copied from class: AbstractFilter
Does any initilaztion of the filter before it can be used. Note; Only called once, before any filters are run.

Specified by:
load in class AbstractFilter

unload

public void unload()
Description copied from class: AbstractFilter
Does any clean up after the filter has been finished. Note; Only called once, when all files have been filtered.

Specified by:
unload in class AbstractFilter

execute

public FilterFile[] execute(FilterFile[] files)
Executes the filter by sending each file to split(). It then adds all the split files to the file file array.

Specified by:
execute in class AbstractFilter
Parameters:
files - an array of FilterFiles to process
Returns:
the filtered files
See Also:
#split(file)

split

public abstract java.util.ArrayList<FilterFile> split(FilterFile file)
Splits a FilterFile into smaller ones.

Parameters:
file - the FilterFile to be split