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 |
---|---|
String |
fieldSeparatorTipText()
Returns the tip text for this property.
|
Capabilities |
getCapabilities()
Returns the Capabilities of this saver.
|
String |
getFieldSeparator()
Returns the character used as column separator.
|
String |
getFileDescription()
Returns a description of the file type.
|
int |
getMaxDecimalPlaces()
Get the maximum number of decimal places to print
|
String |
getMissingValue()
Returns the current placeholder for missing values.
|
boolean |
getNoHeaderRow()
Get whether to not write the header row
|
String[] |
getOptions()
Gets the current settings of the Classifier.
|
String |
getRevision()
Returns the revision string.
|
String |
globalInfo()
Returns a string describing this Saver.
|
Enumeration<Option> |
listOptions()
Returns an enumeration describing the available options.
|
static void |
main(String[] args)
Main method.
|
String |
maxDecimalPlacesTipText()
Returns the tip text for this property.
|
String |
missingValueTipText()
Returns the tip text for this property.
|
String |
noHeaderRowTipText()
Returns the tip text for this property.
|
void |
resetOptions()
Resets the Saver.
|
void |
setFieldSeparator(String value)
Sets the character used as column separator.
|
void |
setMaxDecimalPlaces(int maxDecimal)
Set the maximum number of decimal places to print
|
void |
setMissingValue(String value)
Sets the placeholder for missing values.
|
void |
setNoHeaderRow(boolean b)
Set whether to not write the header row
|
void |
setOptions(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 String globalInfo()
public Enumeration<Option> listOptions()
listOptions
in interface OptionHandler
listOptions
in class AbstractFileSaver
public void setOptions(String[] options) throws 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 stringsException
- if an option is not supportedpublic String[] getOptions()
getOptions
in interface OptionHandler
getOptions
in class AbstractFileSaver
public 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 String maxDecimalPlacesTipText()
public void setFieldSeparator(String value)
value
- the character to usepublic String getFieldSeparator()
public String fieldSeparatorTipText()
public void setMissingValue(String value)
value
- the placeholderpublic String getMissingValue()
public String missingValueTipText()
public 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 IOException
writeIncremental
in interface Saver
writeIncremental
in class AbstractSaver
inst
- the instance to saveIOException
- throws IOEXception if an instance cannot be saved
incrementally.public void writeBatch() throws IOException
writeBatch
in interface Saver
writeBatch
in class AbstractSaver
IOException
- throws IOException if saving in batch mode is not
possiblepublic String getRevision()
getRevision
in interface RevisionHandler
public static void main(String[] args)
args
- should contain the options of a Saver.Copyright © 2020 University of Waikato, Hamilton, NZ. All rights reserved.