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
- Unit separator (0x1F) is column separator
- No quote or escape characters are used
- Carriage return (0x0D) represents embedded newline
- Cell content is arbitrary binary except 0x0A, 0x1F (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, rowSeparator
-
Fields inherited from class org.evolvis.tartools.csvfile.CSVFile
CR, CRLF, DEFAULT_FIELD_SEPARATOR, DEFAULT_TEXT_QUALIFIER, fieldSeparator, LF, textQualifier
-
-
Constructor Summary
Constructors Constructor Description SSVFileWriter(OutputStream stream)SSVFileWriter constructor just needing an OutputStream for the data to write.SSVFileWriter(Writer writer)SSVFileWriter constructor.SSVFileWriter(String outputFileName)SSVFileWriter constructor just needing the name of the SSV file that will be written.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.voidsetRowSeparator(String sep)Throws an exception, the row 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, getRowSeparator, writeFields
-
Methods inherited from class org.evolvis.tartools.csvfile.CSVFile
getFieldSeparator
-
-
-
-
Constructor Detail
-
SSVFileWriter
public SSVFileWriter(String outputFileName) throws IOException
SSVFileWriter constructor just needing the name of the SSV file that will be written. The SSV file will be written in UTF-8 encoding.- Parameters:
outputFileName- The name of the SSV file to be opened for writing- Throws:
IOException- if an error occurs while creating the file
-
SSVFileWriter
public SSVFileWriter(OutputStream stream)
SSVFileWriter constructor just needing an OutputStream for the data to write. The SSV file will be written in UTF-8 encoding.- Parameters:
stream- TheOutputStreamfor writing CSV data
-
-
Method Detail
-
setRowSeparator
public void setRowSeparator(String sep)
Throws an exception, the row separator is constant for SSV.- Overrides:
setRowSeparatorin classCSVFileWriter- Parameters:
sep- The new row separator to be ignored
-
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
-
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
-
-