com.jmw.tzap.filters
Class SplitByRegexFilter

java.lang.Object
  extended by com.jmw.tzap.AbstractFilter
      extended by com.jmw.tzap.SplitFilter
          extended by com.jmw.tzap.filters.SplitByRegexFilter

public class SplitByRegexFilter
extends SplitFilter

Splits a file each time a regex is encountered.
There are several options for this filter.


Field Summary
protected  boolean before
           
protected  boolean drop
           
protected  java.lang.StringBuffer header
           
protected  java.util.regex.Pattern pattern
           
protected  boolean repeatHeader
           
protected  boolean saveHeaderAlone
           
 
Fields inherited from class com.jmw.tzap.SplitFilter
count, endStr, initialCount, totalCount
 
Fields inherited from class com.jmw.tzap.AbstractFilter
encoding, MSG_DEBUG, MSG_ERR, MSG_INFO, MSG_VERBOSE, MSG_WARN, task
 
Constructor Summary
SplitByRegexFilter()
           
 
Method Summary
 void setCutBefore(boolean b)
          Sets the CutBefore flag, which indicates if the split should be performed before or after the regex.
 void setDropRegexText(boolean b)
          Sets the DropRegexText flag, which indicates if the regex should be droped from the split files.
 void setRegex(java.lang.String regex)
          Sets the regex used in spliting the file.
 void setRepeatHeaderInEachFile(boolean b)
          Sets the RepeatHeaderInEachFile flag, which indicates if the header should be repeated in each newly generated file.
 void setSaveHeaderAlone(boolean b)
          Sets the SaveHeaderAlone flag, which indicates if the header should be saved in its own file.
 java.util.ArrayList split(FilterFile file)
          Splits a FilterFile into smaller ones.
 void unload()
          Does any clean up after the filter has been finished.
 void validateParameters()
          Validates any parameters needed by the child filters.
 
Methods inherited from class com.jmw.tzap.SplitFilter
execute, load, setCount, setEndString
 
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

before

protected boolean before

drop

protected boolean drop

saveHeaderAlone

protected boolean saveHeaderAlone

repeatHeader

protected boolean repeatHeader

pattern

protected java.util.regex.Pattern pattern

header

protected java.lang.StringBuffer header
Constructor Detail

SplitByRegexFilter

public SplitByRegexFilter()
Method Detail

setCutBefore

public void setCutBefore(boolean b)
Sets the CutBefore flag, which indicates if the split should be performed before or after the regex. CutBefore defaults to true.

Parameters:
b - the flag value.

setDropRegexText

public void setDropRegexText(boolean b)
Sets the DropRegexText flag, which indicates if the regex should be droped from the split files. DropRegexText defaults to false.

Parameters:
b - the flag value.

setSaveHeaderAlone

public void setSaveHeaderAlone(boolean b)
Sets the SaveHeaderAlone flag, which indicates if the header should be saved in its own file. The header refers to all text found before the first occurance of the search regex.
SaveHeaderAlone defaults to false.

Parameters:
b - the flag value.

setRepeatHeaderInEachFile

public void setRepeatHeaderInEachFile(boolean b)
Sets the RepeatHeaderInEachFile flag, which indicates if the header should be repeated in each newly generated file. RepearHeaderInEachFile defaults to true.

Parameters:
b - the flag value.

setRegex

public void setRegex(java.lang.String regex)
Sets the regex used in spliting the file.

Parameters:
regex - the split regex

validateParameters

public void validateParameters()
                        throws java.lang.Exception
Description copied from class: AbstractFilter
Validates any parameters needed by the child filters.

Specified by:
validateParameters in class AbstractFilter
Throws:
java.lang.Exception

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.

Overrides:
unload in class SplitFilter

split

public java.util.ArrayList split(FilterFile file)
Description copied from class: SplitFilter
Splits a FilterFile into smaller ones.

Specified by:
split in class SplitFilter
Parameters:
file - the FilterFile to be split