public abstract class AbstractFileSaver extends AbstractSaver implements OptionHandler, FileSourcedConverter, EnvironmentHandler
-o the output file
The output file. The prefix of the output file is sufficient. If no output
file is given, Saver tries to use standard out.
| Modifier and Type | Field and Description |
|---|---|
protected Environment |
m_env
Environment variables
|
protected int |
m_incrementalCounter
Counter.
|
protected boolean |
m_useRelativePath
use relative file paths
|
CANCEL, m_DoNotCheckCapabilities, m_retrieval, STRUCTURE_READY, WAIT, WRITEBATCH, INCREMENTAL, NONE| Constructor and Description |
|---|
AbstractFileSaver() |
| Modifier and Type | Method and Description |
|---|---|
void |
cancel()
Cancels the incremental saving process.
|
java.lang.String |
filePrefix()
Gets the file name prefix
|
abstract java.lang.String |
getFileDescription()
to be pverridden
|
java.lang.String |
getFileExtension()
Gets ihe file extension.
|
java.lang.String[] |
getFileExtensions()
Gets all the file extensions used for this type of file
|
java.lang.String[] |
getOptions()
Gets the current settings of the Saver object.
|
boolean |
getUseRelativePath()
Gets whether relative paths are to be used
|
java.io.BufferedWriter |
getWriter()
Gets the writer
|
java.util.Enumeration<Option> |
listOptions()
Returns an enumeration describing the available options.
|
protected static java.lang.String |
makeOptionStr(AbstractFileSaver saver)
generates a string suitable for output on the command line displaying all
available options.
|
void |
resetOptions()
resets the options
|
void |
resetWriter()
Sets the writer to null.
|
java.lang.String |
retrieveDir()
Gets the directory
|
java.io.File |
retrieveFile()
Gets the destination file.
|
static void |
runFileSaver(AbstractFileSaver saver,
java.lang.String[] options)
runs the given saver with the specified options
|
void |
setDestination(java.io.File file)
Sets the destination file (and directories if necessary).
|
void |
setDestination(java.io.OutputStream output)
Sets the destination output stream.
|
void |
setDir(java.lang.String dir)
Sets the directory where the instances should be stored
|
void |
setDirAndPrefix(java.lang.String relationName,
java.lang.String add)
Sets the directory and the file prefix.
|
void |
setEnvironment(Environment env)
Set the environment variables to use.
|
void |
setFile(java.io.File outputFile)
Sets the destination file.
|
protected void |
setFileExtension(java.lang.String ext)
Sets ihe file extension.
|
void |
setFilePrefix(java.lang.String prefix)
Sets the file name prefix
|
void |
setOptions(java.lang.String[] options)
Parses a given list of options.
|
void |
setUseRelativePath(boolean rp)
Set whether to use relative rather than absolute paths
|
java.lang.String |
useRelativePathTipText()
Tip text suitable for displaying int the GUI
|
doNotCheckCapabilitiesTipText, getCapabilities, getDoNotCheckCapabilities, getInstances, getRetrieval, getWriteMode, resetStructure, setDoNotCheckCapabilities, setInstances, setRetrieval, setStructure, setWriteMode, writeBatch, writeIncrementalclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetRevisionprotected int m_incrementalCounter
protected boolean m_useRelativePath
protected transient Environment m_env
public void resetOptions()
resetOptions in class AbstractSaverpublic java.io.BufferedWriter getWriter()
public void resetWriter()
public java.lang.String getFileExtension()
getFileExtension in interface FileSourcedConvertergetFileExtension in interface SavergetFileExtension in class AbstractSaverpublic java.lang.String[] getFileExtensions()
getFileExtensions in interface FileSourcedConverterprotected void setFileExtension(java.lang.String ext)
ext - the file extension as a string startin with '.'.public java.io.File retrieveFile()
retrieveFile in interface FileSourcedConverterpublic void setFile(java.io.File outputFile)
throws java.io.IOException
setFile in interface FileSourcedConvertersetFile in interface SaversetFile in class AbstractSaveroutputFile - the destination file.java.io.IOException - throws an IOException if file cannot be setpublic void setFilePrefix(java.lang.String prefix)
setFilePrefix in interface SaversetFilePrefix in class AbstractSaverprefix - the file name prefixpublic java.lang.String filePrefix()
filePrefix in interface SaverfilePrefix in class AbstractSaverpublic void setDir(java.lang.String dir)
setDir in interface SaversetDir in class AbstractSaverdir - a string containing the directory path and namepublic java.lang.String retrieveDir()
retrieveDir in interface SaverretrieveDir in class AbstractSaverpublic void setEnvironment(Environment env)
setEnvironment in interface EnvironmentHandlerenv - the environment variables to usepublic java.util.Enumeration<Option> listOptions()
listOptions in interface OptionHandlerpublic void setOptions(java.lang.String[] options)
throws java.lang.Exception
-i input arff file
The input filw in arff format.
-o the output file
The output file. The prefix of the output file is sufficient. If no output
file is given, Saver tries to use standard out.
setOptions in interface OptionHandleroptions - the list of options as an array of stringsjava.lang.Exception - if an option is not supportedpublic java.lang.String[] getOptions()
getOptions in interface OptionHandlerpublic void cancel()
cancel in class AbstractSaverpublic void setDestination(java.io.File file)
throws java.io.IOException
setDestination in interface SaversetDestination in class AbstractSaverfile - the Filejava.io.IOException - alwayspublic void setDestination(java.io.OutputStream output)
throws java.io.IOException
setDestination in interface SaversetDestination in class AbstractSaveroutput - the output stream.java.io.IOException - throws an IOException if destination cannot be setpublic void setDirAndPrefix(java.lang.String relationName,
java.lang.String add)
setDirAndPrefix in interface SaversetDirAndPrefix in class AbstractSaverrelationName - the name of the relation to saveadd - additional string which should be part of the filenamepublic abstract java.lang.String getFileDescription()
getFileDescription in interface FileSourcedConverterpublic java.lang.String useRelativePathTipText()
public void setUseRelativePath(boolean rp)
setUseRelativePath in interface FileSourcedConverterrp - true if relative paths are to be usedpublic boolean getUseRelativePath()
getUseRelativePath in interface FileSourcedConverterprotected static java.lang.String makeOptionStr(AbstractFileSaver saver)
saver - the saver to create the option string forpublic static void runFileSaver(AbstractFileSaver saver, java.lang.String[] options)
saver - the saver to runoptions - the commandline options