public final class CSVQuoter extends Object
CSVQuoter is a helper class to encode a string for the CSV file
format.| Constructor and Description |
|---|
CSVQuoter()
Creates a new CSVQuoter, which uses a comma as the default separator.
|
CSVQuoter(char separator)
Creates a new
CSVQuoter, which uses the defined separator. |
CSVQuoter(char separator,
char quate)
Creates a new CSVQuoter with the given separator and quoting character.
|
| Modifier and Type | Method and Description |
|---|---|
String |
doQuoting(String original)
Encodes the string, so that the string can safely be used in CSV files.
|
void |
doQuoting(String original,
Writer writer)
A streaming version of the quoting algorithm for more performance.
|
char |
getQuate()
Returns the quoting character.
|
char |
getSeparator()
Gets the separator used in this quoter and the CSV file.
|
String |
undoQuoting(String nativeString)
Decodes the string, so that all escape sequences get removed.
|
public CSVQuoter()
public CSVQuoter(char separator)
CSVQuoter, which uses the defined separator.separator - the separator.NullPointerException - if the given separator is null.public CSVQuoter(char separator,
char quate)
separator - the separatorquate - the quoting characterpublic String doQuoting(String original)
original - the unquoted string.public void doQuoting(String original, Writer writer) throws IOException
original - the unquoted string.writer - the writer.IOException - if an IO error occured.public String undoQuoting(String nativeString)
nativeString - the quoted string.public char getSeparator()
null).public char getQuate()