Package weka.core.converters
Class XRFFSaver
- java.lang.Object
-
- weka.core.converters.AbstractSaver
-
- weka.core.converters.AbstractFileSaver
-
- weka.core.converters.XRFFSaver
-
- All Implemented Interfaces:
Serializable,CapabilitiesHandler,CapabilitiesIgnorer,BatchConverter,FileSourcedConverter,Saver,EnvironmentHandler,OptionHandler,RevisionHandler,WeightedInstancesHandler
public class XRFFSaver extends AbstractFileSaver implements BatchConverter, WeightedInstancesHandler
Writes to a destination that is in the XML version of the ARFF format. The data can be compressed with gzip, in order to save space. Valid options are:-i <the input file> The input file
-o <the output file> The output file
-C <class index> The class index (first and last are valid as well). (default: last)
-compress Compresses the data (uses '.xrff.gz' as extension instead of '.xrff') (default: off)
- Version:
- $Revision$
- Author:
- FracPete (fracpete at waikato dot ac dot nz)
- See Also:
Saver, Serialized Form
-
-
Field Summary
-
Fields inherited from interface weka.core.converters.Saver
BATCH, INCREMENTAL, NONE
-
-
Constructor Summary
Constructors Constructor Description XRFFSaver()Constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description StringclassIndexTipText()Returns the tip text for this propertyStringcompressOutputTipText()Returns the tip text for this propertyCapabilitiesgetCapabilities()Returns the Capabilities of this saver.StringgetClassIndex()Get the index of the class attribute.booleangetCompressOutput()Gets whether the output data is compressed.StringgetFileDescription()Returns a description of the file type.String[]getFileExtensions()Gets all the file extensions used for this type of fileString[]getOptions()returns the options of the current setupStringgetRevision()Returns the revision string.StringglobalInfo()Returns a string describing this SaverEnumeration<Option>listOptions()Returns an enumeration describing the available options.static voidmain(String[] args)Main method.voidresetOptions()Resets the SavervoidsetClassIndex(String value)Sets index of the class attribute.voidsetCompressOutput(boolean value)Sets whether to compress the output.voidsetDestination(OutputStream output)Sets the destination output stream.voidsetFile(File outputFile)Sets the destination file.voidsetInstances(Instances instances)Sets instances that should be stored.voidsetOptions(String[] options)Parses the options for this object.voidwriteBatch()Writes a Batch of instances-
Methods inherited from class weka.core.converters.AbstractFileSaver
cancel, filePrefix, getFileExtension, getUseRelativePath, getWriter, resetWriter, retrieveDir, retrieveFile, runFileSaver, setDestination, setDir, setDirAndPrefix, setEnvironment, setFilePrefix, setUseRelativePath, useRelativePathTipText
-
Methods inherited from class weka.core.converters.AbstractSaver
doNotCheckCapabilitiesTipText, getDoNotCheckCapabilities, getInstances, getWriteMode, resetStructure, setDoNotCheckCapabilities, setRetrieval, setStructure, writeIncremental
-
-
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing this Saver- Returns:
- a description of the Saver suitable for displaying in the explorer/experimenter gui
-
listOptions
public Enumeration<Option> listOptions()
Returns an enumeration describing the available options.- Specified by:
listOptionsin interfaceOptionHandler- Overrides:
listOptionsin classAbstractFileSaver- Returns:
- an enumeration of all the available options.
-
getOptions
public String[] getOptions()
returns the options of the current setup- Specified by:
getOptionsin interfaceOptionHandler- Overrides:
getOptionsin classAbstractFileSaver- Returns:
- the current options
-
setOptions
public void setOptions(String[] options) throws Exception
Parses the options for this object. Valid options are:-i <the input file> The input file
-o <the output file> The output file
-C <class index> The class index (first and last are valid as well). (default: last)
-compress Compresses the data (uses '.xrff.gz' as extension instead of '.xrff') (default: off)
- Specified by:
setOptionsin interfaceOptionHandler- Overrides:
setOptionsin classAbstractFileSaver- Parameters:
options- the options to use- Throws:
Exception- if setting of options fails
-
getFileDescription
public String getFileDescription()
Returns a description of the file type.- Specified by:
getFileDescriptionin interfaceFileSourcedConverter- Specified by:
getFileDescriptionin classAbstractFileSaver- Returns:
- a short file description
-
getFileExtensions
public String[] getFileExtensions()
Gets all the file extensions used for this type of file- Specified by:
getFileExtensionsin interfaceFileSourcedConverter- Overrides:
getFileExtensionsin classAbstractFileSaver- Returns:
- the file extensions
-
setFile
public void setFile(File outputFile) throws IOException
Sets the destination file.- Specified by:
setFilein interfaceFileSourcedConverter- Specified by:
setFilein interfaceSaver- Overrides:
setFilein classAbstractFileSaver- Parameters:
outputFile- the destination file.- Throws:
IOException- throws an IOException if file cannot be set
-
resetOptions
public void resetOptions()
Resets the Saver- Overrides:
resetOptionsin classAbstractFileSaver
-
classIndexTipText
public String classIndexTipText()
Returns the tip text for this property- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
getClassIndex
public String getClassIndex()
Get the index of the class attribute.- Returns:
- the index of the class attribute
-
setClassIndex
public void setClassIndex(String value)
Sets index of the class attribute.- Parameters:
value- the index of the class attribute
-
compressOutputTipText
public String compressOutputTipText()
Returns the tip text for this property- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
getCompressOutput
public boolean getCompressOutput()
Gets whether the output data is compressed.- Returns:
- true if the output data is compressed
-
setCompressOutput
public void setCompressOutput(boolean value)
Sets whether to compress the output.- Parameters:
value- if truee the output will be compressed
-
getCapabilities
public Capabilities getCapabilities()
Returns the Capabilities of this saver.- Specified by:
getCapabilitiesin interfaceCapabilitiesHandler- Overrides:
getCapabilitiesin classAbstractSaver- Returns:
- the capabilities of this object
- See Also:
Capabilities
-
setInstances
public void setInstances(Instances instances)
Sets instances that should be stored.- Specified by:
setInstancesin interfaceSaver- Overrides:
setInstancesin classAbstractSaver- Parameters:
instances- the instances
-
setDestination
public void setDestination(OutputStream output) throws IOException
Sets the destination output stream.- Specified by:
setDestinationin interfaceSaver- Overrides:
setDestinationin classAbstractFileSaver- Parameters:
output- the output stream.- Throws:
IOException- throws an IOException if destination cannot be set
-
writeBatch
public void writeBatch() throws IOExceptionWrites a Batch of instances- Specified by:
writeBatchin interfaceSaver- Specified by:
writeBatchin classAbstractSaver- Throws:
IOException- throws IOException if saving in batch mode is not possible
-
getRevision
public String getRevision()
Returns the revision string.- Specified by:
getRevisionin interfaceRevisionHandler- Returns:
- the revision
-
main
public static void main(String[] args)
Main method.- Parameters:
args- should contain the options of a Saver.
-
-