public class DelimitedParser extends Object implements Serializable
FieldTypeResolver
maybe used to clean and prepare field names
for data columns, and to infer type information from column names.Modifier and Type | Field and Description |
---|---|
protected Pattern |
cleanPattern
Field cleanPattern
|
protected CoercibleType[] |
coercibles
Fields coercibles
|
protected String |
delimiter
Field delimiter *
|
protected boolean |
enforceStrict
Field enforceStrict
|
protected Pattern |
escapePattern
Field escapePattern
|
protected FieldTypeResolver |
fieldTypeResolver
fieldTypeResolver
|
protected int |
numValues
Field numValues
|
protected String |
quote
Field quote
|
protected boolean |
safe
Field safe
|
protected Fields |
sourceFields
Field sourceFields
|
protected Pattern |
splitPattern
Field splitPattern
|
protected boolean |
strict
Field strict
|
protected Type[] |
types
Field types
|
Constructor and Description |
---|
DelimitedParser(String delimiter,
String quote,
Class[] types) |
DelimitedParser(String delimiter,
String quote,
Class[] types,
boolean strict,
boolean safe) |
DelimitedParser(String delimiter,
String quote,
Class[] types,
boolean strict,
boolean safe,
Fields sourceFields,
Fields sinkFields) |
DelimitedParser(String delimiter,
String quote,
Class[] types,
boolean strict,
boolean safe,
Fields sourceFields,
Fields sinkFields,
FieldTypeResolver fieldTypeResolver) |
DelimitedParser(String delimiter,
String quote,
Class[] types,
boolean strict,
boolean safe,
FieldTypeResolver fieldTypeResolver) |
DelimitedParser(String delimiter,
String quote,
FieldTypeResolver fieldTypeResolver) |
Modifier and Type | Method and Description |
---|---|
protected Object[] |
cleanFields(Object[] result) |
protected Object[] |
cleanParsedLine(Object[] split) |
Object[] |
cleanSplit(Object[] split,
Pattern cleanPattern,
Pattern escapePattern,
String quote)
Method cleanSplit will return a quote free array of String values, the given
split array
will be updated in place. |
protected Object[] |
coerceParsedLine(String line,
Object[] split) |
Pattern |
createCleanPatternFor(String quote)
Method createCleanPatternFor creates a regex
Pattern for removing quote characters from a String. |
Pattern |
createEscapePatternFor(String quote)
Method createEscapePatternFor creates a regex
Pattern cleaning quote escapes from a String. |
String[] |
createSplit(String value,
Pattern splitPattern,
int numValues)
Method createSplit will split the given
value with the given splitPattern . |
Pattern |
createSplitPatternFor(String delimiter,
String quote)
Method createSplitPatternFor creates a regex
Pattern for splitting a line of text into its component
parts using the given delimiter and quote Strings. |
String |
getDelimiter() |
String |
getQuote() |
protected Type[] |
inferTypes(Object[] result) |
Appendable |
joinFirstLine(Iterable iterable,
Appendable buffer) |
Appendable |
joinLine(Iterable iterable,
Appendable buffer) |
protected Appendable |
joinNoQuote(Iterable tuple,
Appendable buffer) |
protected Appendable |
joinWithQuote(Iterable tuple,
Appendable buffer) |
protected Object[] |
onlyParseLine(String line) |
Fields |
parseFirstLine(FlowProcess flowProcess,
Tap tap) |
Object[] |
parseLine(String line) |
protected Iterable |
prepareFields(Iterable fields) |
void |
reset(Fields sourceFields,
Fields sinkFields) |
void |
reset(String delimiter,
String quote,
Type[] types,
boolean strict,
boolean safe,
Fields sourceFields,
Fields sinkFields,
FieldTypeResolver fieldTypeResolver) |
protected Fields sourceFields
protected Pattern splitPattern
protected Pattern cleanPattern
protected Pattern escapePattern
protected boolean strict
protected boolean enforceStrict
protected int numValues
protected CoercibleType[] coercibles
protected boolean safe
protected FieldTypeResolver fieldTypeResolver
public DelimitedParser(String delimiter, String quote, Class[] types)
public DelimitedParser(String delimiter, String quote, Class[] types, boolean strict, boolean safe)
public DelimitedParser(String delimiter, String quote, FieldTypeResolver fieldTypeResolver)
public DelimitedParser(String delimiter, String quote, Class[] types, boolean strict, boolean safe, FieldTypeResolver fieldTypeResolver)
public DelimitedParser(String delimiter, String quote, Class[] types, boolean strict, boolean safe, Fields sourceFields, Fields sinkFields)
public DelimitedParser(String delimiter, String quote, Class[] types, boolean strict, boolean safe, Fields sourceFields, Fields sinkFields, FieldTypeResolver fieldTypeResolver)
public void reset(String delimiter, String quote, Type[] types, boolean strict, boolean safe, Fields sourceFields, Fields sinkFields, FieldTypeResolver fieldTypeResolver)
public String getDelimiter()
public Pattern createEscapePatternFor(String quote)
Pattern
cleaning quote escapes from a String.
If quote
is null or empty, a null value will be returned;quote
- of type Stringpublic Pattern createCleanPatternFor(String quote)
Pattern
for removing quote characters from a String.
If quote
is null or empty, a null value will be returned;quote
- of type Stringpublic Pattern createSplitPatternFor(String delimiter, String quote)
Pattern
for splitting a line of text into its component
parts using the given delimiter and quote Strings. quote
may be null.delimiter
- of type Stringquote
- of type Stringpublic String[] createSplit(String value, Pattern splitPattern, int numValues)
value
with the given splitPattern
.value
- of type StringsplitPattern
- of type PatternnumValues
- of type intpublic Object[] cleanSplit(Object[] split, Pattern cleanPattern, Pattern escapePattern, String quote)
split
array
will be updated in place.
If cleanPattern
is null, quote cleaning will not be performed, but all empty String values
will be replaces with a null
value.split
- of type Object[]cleanPattern
- of type PatternescapePattern
- of type Patternquote
- of type Stringpublic Fields parseFirstLine(FlowProcess flowProcess, Tap tap)
protected Object[] cleanParsedLine(Object[] split)
protected Object[] coerceParsedLine(String line, Object[] split)
protected Object[] onlyParseLine(String line)
public Appendable joinFirstLine(Iterable iterable, Appendable buffer)
public Appendable joinLine(Iterable iterable, Appendable buffer)
protected Appendable joinWithQuote(Iterable tuple, Appendable buffer) throws IOException
IOException
protected Appendable joinNoQuote(Iterable tuple, Appendable buffer) throws IOException
IOException
protected Type[] inferTypes(Object[] result)
protected Iterable prepareFields(Iterable fields)
protected Object[] cleanFields(Object[] result)
Copyright © 2007-2015 Concurrent, Inc. All Rights Reserved.