com.univocity.parsers.csv
Class CsvFormat

java.lang.Object
  extended by com.univocity.parsers.common.Format
      extended by com.univocity.parsers.csv.CsvFormat
All Implemented Interfaces:
Cloneable

public class CsvFormat
extends Format

The CSV format configuration. In addition to the default configuration in Format, the CSV format defines:

Author:
uniVocity Software Pty Ltd - parsers@univocity.com
See Also:
Format

Constructor Summary
CsvFormat()
           
 
Method Summary
 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.
 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 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 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.
 
Methods inherited from class com.univocity.parsers.common.Format
getComment, getLineSeparator, getLineSeparatorString, getNormalizedNewline, getSystemLineSeparator, isComment, isNewLine, setComment, setLineSeparator, setLineSeparator, setNormalizedNewline, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CsvFormat

public CsvFormat()
Method Detail

getQuote

public char getQuote()
Returns the character used for escaping values where the field delimiter is part of the value. Defaults to '"'

Returns:
the quote character

setQuote

public void setQuote(char quote)
Defines the character used for escaping values where the field delimiter is part of the value. Defaults to '"'

Parameters:
quote - the quote character

isQuote

public 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

Parameters:
ch - the character to be verified
Returns:
true if the given character is the character used for escaping values, false otherwise

getQuoteEscape

public char getQuoteEscape()
Returns the character used for escaping quotes inside an already quoted value. Defaults to '"'

Returns:
the quote escape character

setQuoteEscape

public void setQuoteEscape(char quoteEscape)
Defines the character used for escaping quotes inside an already quoted value. Defaults to '"'

Parameters:
quoteEscape - the quote escape character

isQuoteEscape

public boolean isQuoteEscape(char ch)
Identifies whether or not a given character is used for escaping quotes inside an already quoted value.

Parameters:
ch - the character to be verified
Returns:
true if the given character is the quote escape character, false otherwise

getDelimiter

public char getDelimiter()
Returns the field delimiter character. Defaults to ','

Returns:
the field delimiter character

setDelimiter

public void setDelimiter(char delimiter)
Defines the field delimiter character. Defaults to ','

Parameters:
delimiter - the field delimiter character

isDelimiter

public boolean isDelimiter(char ch)
Identifies whether or not a given character represents a field delimiter

Parameters:
ch - the character to be verified
Returns:
true if the given character is the field delimiter character, false otherwise

getCharToEscapeQuoteEscaping

public final char getCharToEscapeQuoteEscaping()
Returns the character used to escape the character used for escaping quotes defined by getQuoteEscape(). For example, if the quote escape is set to '\', and the quoted value ends with: \", as in the following example:

[ " a\\", b ]

Then: Defaults to '\0' (undefined)

Returns:
the character to escape the character used for escaping quotes defined

setCharToEscapeQuoteEscaping

public final void setCharToEscapeQuoteEscaping(char charToEscapeQuoteEscaping)
Defines the character used to escape the character used for escaping quotes defined by getQuoteEscape(). For example, if the quote escape is set to '\', and the quoted value ends with: \", as in the following example:

[ " a\\", b ]

Then: Defaults to '\0' (undefined)

Parameters:
charToEscapeQuoteEscaping - the character to escape the character used for escaping quotes defined

isCharToEscapeQuoteEscaping

public final boolean isCharToEscapeQuoteEscaping(char ch)
Identifies whether or not a given character is used to escape the character used for escaping quotes defined by getQuoteEscape().

Parameters:
ch - the character to be verified
Returns:
true if the given character is used to escape the quote escape character, false otherwise

getConfiguration

protected TreeMap<String,Object> getConfiguration()
Specified by:
getConfiguration in class Format

clone

public final CsvFormat clone()
Overrides:
clone in class Format


Copyright © 2018 uniVocity Software Pty Ltd. All rights reserved.