public class RFC4180Parser extends AbstractCSVParser
Since it shares the same interface with the CSVParser there are methods here that will do nothing. For example, the RFC4180 specification does not have a concept of an escape character, so the getEscape method will return char 0. The methods that are not supported are noted in the Javadocs.
Another departure from the CSVParser is that there are only two constructors and only one is available publicly. The intent is that if you want to create anything other than a default RFC4180Parser you should use the CSVParserBuilder. This way the code will not become cluttered with constructors as the CSVParser did.
You can view the RFC4180 specification at the Internet Engineering Task Force (IETF) website.
Examples:
ICSVParser parser = new RFC4180Parser();
or
CSVParserBuilder builder = new CSVParserBuilder()
ICSVParser parser = builder.withParserType(ParserType.RFC4180Parser).build()
nullFieldIndicator, pending, quotechar, separatorDEFAULT_BUNDLE_NAME, DEFAULT_ESCAPE_CHARACTER, DEFAULT_IGNORE_LEADING_WHITESPACE, DEFAULT_IGNORE_QUOTATIONS, DEFAULT_NULL_FIELD_INDICATOR, DEFAULT_QUOTE_CHARACTER, DEFAULT_SEPARATOR, DEFAULT_STRICT_QUOTES, INITIAL_READ_SIZE, MAX_SIZE_FOR_EMPTY_FIELD, NEWLINE, NULL_CHARACTER, READ_BUFFER_SIZE| Modifier | Constructor and Description |
|---|---|
|
RFC4180Parser()
Default constructor for the RFC4180Parser.
|
protected |
RFC4180Parser(char quoteChar,
char separator,
CSVReaderNullFieldIndicator nullFieldIndicator)
Constructor used by the CSVParserBuilder.
|
| Modifier and Type | Method and Description |
|---|---|
protected String |
convertToCsvValue(String value,
boolean applyQuotesToAll)
Used when reverse parsing an array of strings to a single string.
|
protected String[] |
parseLine(String nextLine,
boolean multi)
Parses an incoming String and returns an array of elements.
|
void |
setErrorLocale(Locale errorLocale)
Sets the locale for all error messages.
|
convertToCsvValue, getPendingText, getQuotechar, getQuotecharAsString, getQuoteDoubledAsString, getQuoteMatcherPattern, getSeparator, getSeparatorAsString, isPending, isSurroundWithQuotes, nullFieldIndicator, parseLine, parseLineMulti, parseToLine, parseToLinepublic RFC4180Parser()
protected RFC4180Parser(char quoteChar,
char separator,
CSVReaderNullFieldIndicator nullFieldIndicator)
separator - The delimiter to use for separating entriesquoteChar - The character to use for quoted elementsnullFieldIndicator - Indicate what should be considered nullprotected String convertToCsvValue(String value, boolean applyQuotesToAll)
AbstractCSVParserconvertToCsvValue in class AbstractCSVParservalue - String to be convertedapplyQuotesToAll - All values should be surrounded with quotesprotected String[] parseLine(String nextLine, boolean multi)
parseLine in class AbstractCSVParsernextLine - The string to parsemulti - Does it take multiple lines to form a single record?public void setErrorLocale(Locale errorLocale)
ICSVParsererrorLocale - Locale for error messages. If null, the default locale
is used.Copyright © 2005–2025. All rights reserved.