public class CSVSaver extends AbstractFileSaver implements BatchConverter, IncrementalConverter, FileSourcedConverter
-F <separator> The field separator to be used. '\t' can be used as well. (default: ',')
-M <str> The string representing a missing value. (default: ?)
-N Don't write a header row.
-decimal <num> The maximum number of digits to print after the decimal place for numeric values (default: 6)
-i <the input file> The input file
-o <the output file> The output file
Saver
,
Serialized FormBATCH, INCREMENTAL, NONE
Constructor and Description |
---|
CSVSaver()
Constructor.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
fieldSeparatorTipText()
Returns the tip text for this property.
|
Capabilities |
getCapabilities()
Returns the Capabilities of this saver.
|
java.lang.String |
getFieldSeparator()
Returns the character used as column separator.
|
java.lang.String |
getFileDescription()
Returns a description of the file type.
|
int |
getMaxDecimalPlaces()
Get the maximum number of decimal places to print
|
java.lang.String |
getMissingValue()
Returns the current placeholder for missing values.
|
boolean |
getNoHeaderRow()
Get whether to not write the header row
|
java.lang.String[] |
getOptions()
Gets the current settings of the Classifier.
|
java.lang.String |
getRevision()
Returns the revision string.
|
java.lang.String |
globalInfo()
Returns a string describing this Saver.
|
java.util.Enumeration<Option> |
listOptions()
Returns an enumeration describing the available options.
|
static void |
main(java.lang.String[] args)
Main method.
|
java.lang.String |
maxDecimalPlacesTipText()
Returns the tip text for this property.
|
java.lang.String |
missingValueTipText()
Returns the tip text for this property.
|
java.lang.String |
noHeaderRowTipText()
Returns the tip text for this property.
|
void |
resetOptions()
Resets the Saver.
|
void |
setFieldSeparator(java.lang.String value)
Sets the character used as column separator.
|
void |
setMaxDecimalPlaces(int maxDecimal)
Set the maximum number of decimal places to print
|
void |
setMissingValue(java.lang.String value)
Sets the placeholder for missing values.
|
void |
setNoHeaderRow(boolean b)
Set whether to not write the header row
|
void |
setOptions(java.lang.String[] options)
Valid options are:
|
void |
writeBatch()
Writes a Batch of instances.
|
void |
writeIncremental(Instance inst)
Saves an instances incrementally.
|
cancel, filePrefix, getFileExtension, getFileExtensions, getUseRelativePath, getWriter, resetWriter, retrieveDir, retrieveFile, runFileSaver, setDestination, setDestination, setDir, setDirAndPrefix, setEnvironment, setFile, setFilePrefix, setUseRelativePath, useRelativePathTipText
doNotCheckCapabilitiesTipText, getDoNotCheckCapabilities, getInstances, getWriteMode, resetStructure, setDoNotCheckCapabilities, setInstances, setRetrieval, setStructure
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getFileExtension, getFileExtensions, getUseRelativePath, retrieveFile, setFile, setUseRelativePath
makeCopy
public java.lang.String globalInfo()
public java.util.Enumeration<Option> listOptions()
listOptions
in interface OptionHandler
listOptions
in class AbstractFileSaver
public void setOptions(java.lang.String[] options) throws java.lang.Exception
-F <separator> The field separator to be used. '\t' can be used as well. (default: ',')
-M <str> The string representing a missing value. (default: ?)
-N Don't write a header row.
-decimal <num> The maximum number of digits to print after the decimal place for numeric values (default: 6)
-i <the input file> The input file
-o <the output file> The output file
setOptions
in interface OptionHandler
setOptions
in class AbstractFileSaver
options
- the list of options as an array of stringsjava.lang.Exception
- if an option is not supportedpublic java.lang.String[] getOptions()
getOptions
in interface OptionHandler
getOptions
in class AbstractFileSaver
public java.lang.String noHeaderRowTipText()
public void setNoHeaderRow(boolean b)
b
- true if no header row is to be writtenpublic boolean getNoHeaderRow()
public void setMaxDecimalPlaces(int maxDecimal)
maxDecimal
- the maximum number of decimal places to printpublic int getMaxDecimalPlaces()
public java.lang.String maxDecimalPlacesTipText()
public void setFieldSeparator(java.lang.String value)
value
- the character to usepublic java.lang.String getFieldSeparator()
public java.lang.String fieldSeparatorTipText()
public void setMissingValue(java.lang.String value)
value
- the placeholderpublic java.lang.String getMissingValue()
public java.lang.String missingValueTipText()
public java.lang.String getFileDescription()
getFileDescription
in interface FileSourcedConverter
getFileDescription
in class AbstractFileSaver
public void resetOptions()
resetOptions
in class AbstractFileSaver
public Capabilities getCapabilities()
getCapabilities
in interface CapabilitiesHandler
getCapabilities
in class AbstractSaver
Capabilities
public void writeIncremental(Instance inst) throws java.io.IOException
writeIncremental
in interface Saver
writeIncremental
in class AbstractSaver
inst
- the instance to savejava.io.IOException
- throws IOEXception if an instance cannot be saved
incrementally.public void writeBatch() throws java.io.IOException
writeBatch
in interface Saver
writeBatch
in class AbstractSaver
java.io.IOException
- throws IOException if saving in batch mode is not
possiblepublic java.lang.String getRevision()
getRevision
in interface RevisionHandler
public static void main(java.lang.String[] args)
args
- should contain the options of a Saver.