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.
|
void |
setCharToEscapeQuoteEscaping(char charToEscapeQuoteEscaping)
Defines the character used to escape the character used for escaping quotes defined by
getQuoteEscape() . |
void |
setDelimiter(char delimiter)
Defines the field delimiter character.
|
void |
setDelimiter(String delimiter)
Defines the field delimiter as a sequence of characters.
|
void |
setQuote(char quote)
Defines the character used for escaping values where the field delimiter is part of the value.
|
void |
setQuoteEscape(char quoteEscape)
Defines the character used for escaping quotes inside an already quoted value.
|
getComment, getLineSeparator, getLineSeparatorString, getNormalizedNewline, getSystemLineSeparator, isComment, isNewLine, setComment, setLineSeparator, setLineSeparator, setNormalizedNewline, toString
public char getQuote()
public void setQuote(char quote)
quote
- the quote characterpublic boolean isQuote(char ch)
ch
- the character to be verifiedpublic char getQuoteEscape()
public void setQuoteEscape(char quoteEscape)
quoteEscape
- the quote escape characterpublic boolean isQuoteEscape(char ch)
ch
- the character to be verifiedpublic char getDelimiter()
public String getDelimiterString()
String
.public void setDelimiter(char delimiter)
delimiter
- the field delimiter characterpublic void setDelimiter(String delimiter)
delimiter
- the field delimiter sequence.public 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 void 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 definedpublic final boolean isCharToEscapeQuoteEscaping(char ch)
getQuoteEscape()
.ch
- the character to be verifiedprotected TreeMap<String,Object> getConfiguration()
getConfiguration
in class Format
Copyright © 2019 Univocity Software Pty Ltd. All rights reserved.