public class RFC4180Parser extends Object implements ICSVParser
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 an 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 is 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.
Examples:
ICSVParser parser = new RFC4180Parser();
or
CSVParserBuilder builder = new CSVParserBuilder()
ICSVParser parser = builder.withParserType(ParserType.RFC4180Parser).build()
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, NULL_CHARACTER, READ_BUFFER_SIZE
Constructor and Description |
---|
RFC4180Parser()
Default constructor for the RFC4180Parser.
|
Modifier and Type | Method and Description |
---|---|
char |
getQuotechar() |
char |
getSeparator() |
boolean |
isPending() |
CSVReaderNullFieldIndicator |
nullFieldIndicator() |
String[] |
parseLine(String nextLine)
Parses an incoming String and returns an array of elements.
|
protected String[] |
parseLine(String nextLine,
boolean multi)
Parses an incoming String and returns an array of elements.
|
String[] |
parseLineMulti(String nextLine)
Parses an incoming String and returns an array of elements.
|
public RFC4180Parser()
public char getSeparator()
getSeparator
in interface ICSVParser
public char getQuotechar()
getQuotechar
in interface ICSVParser
public boolean isPending()
isPending
in interface ICSVParser
public String[] parseLineMulti(String nextLine) throws IOException
ICSVParser
parseLineMulti
in interface ICSVParser
nextLine
- Current line to be processedIOException
- If bad things happen during the readpublic String[] parseLine(String nextLine) throws IOException
ICSVParser
parseLine
in interface ICSVParser
nextLine
- Line to be parsed.IOException
- If bad things happen during the readprotected String[] parseLine(String nextLine, boolean multi) throws IOException
nextLine
- The string to parsemulti
- Does it take multiple lines to form a single record?IOException
- If bad things happen during the readpublic CSVReaderNullFieldIndicator nullFieldIndicator()
nullFieldIndicator
in interface ICSVParser
Copyright © 2017. All rights reserved.