public class FieldParserImpl extends Object implements FieldParser, GlobalConstants
A FieldParser implementation.
UTF_8, UTF_8_CHARSET| Constructor and Description |
|---|
FieldParserImpl(boolean allowEmptyLines,
boolean returnEmptyLines,
boolean allowNamelessFields)
Creates a parser.
|
| Modifier and Type | Method and Description |
|---|---|
List<Field> |
parseFieldsAsList(DataSource source,
Context context)
Parses fields from the specified source.
|
Map<String,Field> |
parseFieldsAsMap(DataSource source,
Context context)
Parses fields from the specified source.
|
public FieldParserImpl(boolean allowEmptyLines,
boolean returnEmptyLines,
boolean allowNamelessFields)
Creates a parser.
allowEmptyLines - The flag if empty lines are allowed. Otherwise a
ParseException is thrown when an empty line is found.returnEmptyLines - The flag if empty lines should be returned by the
parseFieldsAsList(DataSource, Context) method.allowNamelessFields - The flag if nameless fields should not throw a
ParseException.public Map<String,Field> parseFieldsAsMap(DataSource source, Context context) throws IOException, ParseException
FieldParserParses fields from the specified source.
The key of the returned map is the field name in lower-case.
If a field with the same name occurs twice or more a
ParseException is thrown.
Empty fields as well as nameless fields are ignored and never returned.
parseFieldsAsMap in interface FieldParsersource - The source.context - The context.IOException - If an I/O error occurs.ParseException - If an error occurs during the parsing.public List<Field> parseFieldsAsList(DataSource source, Context context) throws IOException, ParseException
FieldParserParses fields from the specified source.
Empty fields are returned based on the configuration of the
FieldParser implementation.
parseFieldsAsList in interface FieldParsersource - The source.context - The context.IOException - If an I/O error occurs.ParseException - If an error occurs during the parsing.Copyright © 2015–2019. All rights reserved.