Package adams.flow.transformer.splitfile
Class AbstractFileSplitter
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.flow.transformer.splitfile.AbstractFileSplitter
-
- All Implemented Interfaces:
Destroyable
,GlobalInfoSupporter
,LoggingLevelHandler
,LoggingSupporter
,OptionHandler
,SizeOfHandler
,Stoppable
,Serializable
- Direct Known Subclasses:
SplitByLineCount
,SplitByNumber
,SplitBySize
public abstract class AbstractFileSplitter extends AbstractOptionHandler implements Stoppable
Ancestor for file splitters.- Version:
- $Revision$
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected String
m_Extension
the file extension to use.protected List<File>
m_Generated
the files that were generated.protected int
m_NumDigits
the number of digits to use for the index of output files.protected PlaceholderFile
m_Prefix
the file prefix.protected boolean
m_Stopped
whether the splitting has been stopped.-
Fields inherited from class adams.core.option.AbstractOptionHandler
m_OptionManager
-
Fields inherited from class adams.core.logging.LoggingObject
m_Logger, m_LoggingIsEnabled, m_LoggingLevel
-
-
Constructor Summary
Constructors Constructor Description AbstractFileSplitter()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected void
check(PlaceholderFile file)
Performs checks on the file.void
defineOptions()
Adds options to the internal list of options.protected abstract void
doSplit(PlaceholderFile file)
Performs the actual splitting of the file.String
extensionTipText()
Returns the tip text for this property.String
getExtension()
Returns the extension for the generated files.int
getNumDigits()
Returns the number of digits to use for the index of the generated files.PlaceholderFile
getPrefix()
Returns the prefix for the generated files.protected File
nextFile()
Creates a new filename, automatically adding it to the list of generated files.String
numDigitsTipText()
Returns the tip text for this property.String
prefixTipText()
Returns the tip text for this property.protected void
reset()
Resets the scheme.void
setExtension(String value)
Sets the extension for the generated files.void
setNumDigits(int value)
Sets the number of digits to use for the index of the generated files.void
setPrefix(PlaceholderFile value)
Sets the prefix for the generated files.String[]
split(PlaceholderFile file)
Splits the file and returns the filenames of the generated files.void
stopExecution()
Stops the execution.-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, globalInfo, initialize, loggingLevelTipText, newOptionManager, setLoggingLevel, toCommandLine, toString
-
Methods inherited from class adams.core.logging.LoggingObject
configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel
-
-
-
-
Field Detail
-
m_Prefix
protected PlaceholderFile m_Prefix
the file prefix.
-
m_Extension
protected String m_Extension
the file extension to use.
-
m_NumDigits
protected int m_NumDigits
the number of digits to use for the index of output files.
-
m_Stopped
protected boolean m_Stopped
whether the splitting has been stopped.
-
-
Method Detail
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptions
in interfaceOptionHandler
- Overrides:
defineOptions
in classAbstractOptionHandler
-
reset
protected void reset()
Resets the scheme.- Overrides:
reset
in classAbstractOptionHandler
-
setPrefix
public void setPrefix(PlaceholderFile value)
Sets the prefix for the generated files.- Parameters:
value
- the prefix
-
getPrefix
public PlaceholderFile getPrefix()
Returns the prefix for the generated files.- Returns:
- the prefix
-
prefixTipText
public String prefixTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setExtension
public void setExtension(String value)
Sets the extension for the generated files.- Parameters:
value
- the extension
-
getExtension
public String getExtension()
Returns the extension for the generated files.- Returns:
- the extension
-
extensionTipText
public String extensionTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setNumDigits
public void setNumDigits(int value)
Sets the number of digits to use for the index of the generated files.- Parameters:
value
- the number of digits
-
getNumDigits
public int getNumDigits()
Returns the number of digits to use for the index of the generated files.- Returns:
- the number of digits
-
numDigitsTipText
public String numDigitsTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
check
protected void check(PlaceholderFile file)
Performs checks on the file.
Default implementation only ensures that the file is present and not a directory.- Parameters:
file
- the file to check
-
nextFile
protected File nextFile()
Creates a new filename, automatically adding it to the list of generated files.- Returns:
- the next file
-
doSplit
protected abstract void doSplit(PlaceholderFile file)
Performs the actual splitting of the file.- Parameters:
file
- the file to split
-
split
public String[] split(PlaceholderFile file)
Splits the file and returns the filenames of the generated files.- Parameters:
file
- the file to split- Returns:
- the filenames of the new files generated
-
stopExecution
public void stopExecution()
Stops the execution.- Specified by:
stopExecution
in interfaceStoppable
-
-