public final class AsciiParser.DelimParser extends java.lang.Object implements AsciiParser.RecordParser
| Modifier and Type | Field and Description |
|---|---|
java.lang.String |
header |
| Constructor and Description |
|---|
DelimParser(int fieldCount,
java.lang.String delim) |
| Modifier and Type | Method and Description |
|---|---|
int |
fieldCount()
indicate the number of fields this RecordParser is
expecting on each line.
|
int |
fieldCount(java.lang.String line)
return the number of fields in this line.
|
java.lang.String |
getDelim()
returns the delimiter, which is a regex.
|
java.lang.String |
readNextRecord(java.io.BufferedReader reader)
return the next record in a String, or null of no more records exist.
|
void |
setGuessUnits(boolean guess)
if true, then try to guess the units of the data coming in.
|
void |
setShowException(boolean s) |
void |
setSkipField(int ifield,
boolean skip) |
boolean |
splitRecord(java.lang.String input,
java.lang.String[] fields)
attempts to extract fields from the record, returning true if
the record could be split.
|
java.lang.String |
toString() |
boolean |
tryParseRecord(java.lang.String line,
int irec,
DataSetBuilder builder)
returns true if the line appears to be a record.
|
public DelimParser(int fieldCount,
java.lang.String delim)
fieldCount - delim - the delimiter pattern, such as "," or "\s+"public java.lang.String getDelim()
public void setShowException(boolean s)
public void setGuessUnits(boolean guess)
guess - public java.lang.String readNextRecord(java.io.BufferedReader reader)
throws java.io.IOException
AsciiParser.RecordParserreadNextRecord in interface AsciiParser.RecordParserjava.io.IOExceptionpublic boolean tryParseRecord(java.lang.String line,
int irec,
DataSetBuilder builder)
AsciiParser.RecordParsertryParseRecord in interface AsciiParser.RecordParserline - the line from the file.irec - the record numberbuilder - the builder into which the data is inserted.public int fieldCount()
AsciiParser.RecordParserfieldCount in interface AsciiParser.RecordParserpublic int fieldCount(java.lang.String line)
AsciiParser.RecordParserfieldCount in interface AsciiParser.RecordParserline - the line from the file, to attempt parsing.public void setSkipField(int ifield,
boolean skip)
public boolean splitRecord(java.lang.String input,
java.lang.String[] fields)
AsciiParser.RecordParsersplitRecord in interface AsciiParser.RecordParserinput - the line from the file.fields - array to store the fields. fieldCount() should be used
to determine the length of the array.public java.lang.String toString()
toString in class java.lang.Object