public class CsvFormat extends Format
Format, the CSV format defines:
e.g. the value a , b is parsed as [ a ][ b ]
e.g. the value " a , b " is parsed as [ a , b ] (instead of [ a ][ b ]
e.g. the value " "" a , b "" " is parsed as [ " a , b " ] (instead of [ " a ][ b " ] or [ "" a , b "" ])
e.g. if the quoteEscape and charToEscapeQuoteEscaping are set to '\', the value " \\\" a , b \\\" " is parsed as [ \" a , b \" ]
Format| Constructor and Description |
|---|
CsvFormat() |
| Modifier and Type | Method and Description |
|---|---|
CsvFormat |
clone() |
char |
getCharToEscapeQuoteEscaping()
Returns the character used to escape the character used for escaping quotes defined by
getQuoteEscape(). |
protected TreeMap<String,Object> |
getConfiguration() |
char |
getDelimiter()
Returns the field delimiter character.
|
String |
getDelimiterString()
Returns the field delimiter sequence.
|
char |
getQuote()
Returns the character used for escaping values where the field delimiter is part of the value.
|
char |
getQuoteEscape()
Returns the character used for escaping quotes inside an already quoted value.
|
boolean |
isCharToEscapeQuoteEscaping(char ch)
Identifies whether or not a given character is used to escape the character used for escaping quotes defined by
getQuoteEscape(). |
boolean |
isDelimiter(char ch)
Identifies whether or not a given character represents a field delimiter
|
boolean |
isDelimiter(String sequence)
Identifies whether or not a given character represents a field delimiter
|
boolean |
isQuote(char ch)
Identifies whether or not a given character is used for escaping values where the field delimiter is part of the value
|
boolean |
isQuoteEscape(char ch)
Identifies whether or not a given character is used for escaping quotes inside an already quoted value.
|
CsvFormat |
setCharToEscapeQuoteEscaping(char charToEscapeQuoteEscaping)
Defines the character used to escape the character used for escaping quotes defined by
getQuoteEscape(). |
CsvFormat |
setComment(char comment)
Defines the character that represents a line comment when found in the beginning of a line of text.
|
CsvFormat |
setDelimiter(char delimiter)
Defines the field delimiter character.
|
CsvFormat |
setDelimiter(String delimiter)
Defines the field delimiter as a sequence of characters.
|
CsvFormat |
setLineSeparator(char[] lineSeparator)
Defines the line separator sequence that should be used for parsing and writing.
|
CsvFormat |
setLineSeparator(String lineSeparator)
Defines the line separator sequence that should be used for parsing and writing.
|
CsvFormat |
setNormalizedNewline(char normalizedNewline)
Sets the normalized newline character, which is automatically replaced by
Format.getLineSeparator() when reading/writing |
CsvFormat |
setQuote(char quote)
Defines the character used for escaping values where the field delimiter is part of the value.
|
CsvFormat |
setQuoteEscape(char quoteEscape)
Defines the character used for escaping quotes inside an already quoted value.
|
getComment, getLineSeparator, getLineSeparatorString, getNormalizedNewline, getSystemLineSeparator, isComment, isNewLine, toStringpublic char getQuote()
public CsvFormat setQuote(char quote)
quote - the quote characterCsvFormat instancepublic boolean isQuote(char ch)
ch - the character to be verifiedpublic char getQuoteEscape()
public CsvFormat setQuoteEscape(char quoteEscape)
quoteEscape - the quote escape characterCsvFormat instancepublic boolean isQuoteEscape(char ch)
ch - the character to be verifiedpublic char getDelimiter()
public String getDelimiterString()
String.public CsvFormat setDelimiter(char delimiter)
delimiter - the field delimiter characterCsvFormat instancepublic CsvFormat setDelimiter(String delimiter)
delimiter - the field delimiter sequence.CsvFormat instancepublic boolean isDelimiter(char ch)
ch - the character to be verifiedpublic boolean isDelimiter(String sequence)
sequence - the character sequence to be verifiedpublic final char getCharToEscapeQuoteEscaping()
getQuoteEscape().
For example, if the quote escape is set to '\', and the quoted value ends with: \", as in the following example:
[ " a\\", b ]
Then:public final CsvFormat setCharToEscapeQuoteEscaping(char charToEscapeQuoteEscaping)
getQuoteEscape().
For example, if the quote escape is set to '\', and the quoted value ends with: \", as in the following example:
[ " a\\", b ]
Then:charToEscapeQuoteEscaping - the character to escape the character used for escaping quotes definedCsvFormat instancepublic final boolean isCharToEscapeQuoteEscaping(char ch)
getQuoteEscape().ch - the character to be verifiedpublic CsvFormat setLineSeparator(String lineSeparator)
setLineSeparator in class FormatlineSeparator - a sequence of 1 to 2 characters that identifies the end of a lineCsvFormat instancepublic CsvFormat setLineSeparator(char[] lineSeparator)
setLineSeparator in class FormatlineSeparator - a sequence of 1 to 2 characters that identifies the end of a lineCsvFormat instancepublic CsvFormat setNormalizedNewline(char normalizedNewline)
Format.getLineSeparator() when reading/writingsetNormalizedNewline in class FormatnormalizedNewline - a single character used to represent a line separator.CsvFormat instancepublic CsvFormat setComment(char comment)
Use '\0' to disable comment skipping.
setComment in class Formatcomment - the comment characterCsvFormat instanceprotected TreeMap<String,Object> getConfiguration()
getConfiguration in class FormatCopyright © 2024. All rights reserved.