Package org.evolvis.tartools.csvfile
Class SSVFileWriter
- java.lang.Object
-
- org.evolvis.tartools.csvfile.CSVFile
-
- org.evolvis.tartools.csvfile.CSVFileWriter
-
- org.evolvis.tartools.csvfile.SSVFileWriter
-
public class SSVFileWriter extends CSVFileWriter
CSVFileWritersubclass to write the SSV format:- Line feed (0x0A) is row separator
- Field separator (0x1C) is column separator
- No quote or escape characters are used
- Carriage return (0x0D) represents embedded newline
- Cell content is arbitrary binary except 0x0A, 0x1C (and NUL)
- Author:
- mirabilos (t.glaser@tarent.de)
- See Also:
- SSV at shellsnippets @ Evolvis
-
-
Field Summary
-
Fields inherited from class org.evolvis.tartools.csvfile.CSVFileWriter
out
-
Fields inherited from class org.evolvis.tartools.csvfile.CSVFile
DEFAULT_FIELD_SEPARATOR, DEFAULT_TEXT_QUALIFIER, fieldSeparator, textQualifier
-
-
Constructor Summary
Constructors Constructor Description SSVFileWriter(Writer writer)SSVFileWriter constructor.SSVFileWriter(String outputFileName)SSVFileWriter constructor just need the name of the SSV file that will be written.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidemitRowSeparator()Called after a list of fields has been output.chargetTextQualifier()Throws an exception, SSV has no quote character.protected StringprepareField(Object field)Prepares a field for output by stringifying the passed object according to SSV rules.voidsetFieldSeparator(char sep)Throws an exception, the field separator is constant for SSV.voidsetTextQualifier(char qual)Throws an exception, SSV has no quote character.-
Methods inherited from class org.evolvis.tartools.csvfile.CSVFileWriter
close, writeFields
-
Methods inherited from class org.evolvis.tartools.csvfile.CSVFile
getFieldSeparator
-
-
-
-
Constructor Detail
-
SSVFileWriter
public SSVFileWriter(String outputFileName) throws IOException
SSVFileWriter constructor just need the name of the SSV file that will be written.- Parameters:
outputFileName- The name of the SSV file to be opened for writing- Throws:
IOException- if an error occurs while creating the file
-
-
Method Detail
-
setFieldSeparator
public void setFieldSeparator(char sep)
Throws an exception, the field separator is constant for SSV.- Overrides:
setFieldSeparatorin classCSVFile- Parameters:
sep- The new field separator to be ignored
-
setTextQualifier
public void setTextQualifier(char qual)
Throws an exception, SSV has no quote character.- Overrides:
setTextQualifierin classCSVFile- Parameters:
qual- The new text qualifier to be ignored
-
getTextQualifier
public char getTextQualifier()
Throws an exception, SSV has no quote character.- Overrides:
getTextQualifierin classCSVFile- Returns:
- The char containing the current text qualifier
-
emitRowSeparator
protected void emitRowSeparator()
Called after a list of fields has been output.- Overrides:
emitRowSeparatorin classCSVFileWriter
-
prepareField
protected String prepareField(Object field)
Prepares a field for output by stringifying the passed object according to SSV rules.- Overrides:
prepareFieldin classCSVFileWriter- Parameters:
field- to prepare- Returns:
- string for output
-
-