public final class AsciiParser.FixedColumnsParser extends java.lang.Object implements AsciiParser.RecordParser
Constructor and Description |
---|
FixedColumnsParser(int[] columnOffsets,
int[] columnWidths) |
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[] |
fields(java.lang.String line) |
java.lang.String |
readNextRecord(java.io.BufferedReader reader)
return the next record in a String, or null of no more records exist.
|
boolean |
splitRecord(java.lang.String line,
java.lang.String[] fields)
attempts to extract fields from the record, returning true if
the record could be split.
|
boolean |
tryParseRecord(java.lang.String line,
int irec,
DataSetBuilder builder)
returns true if the line appears to be a record.
|
public FixedColumnsParser(int[] columnOffsets, int[] columnWidths)
public int fieldCount()
AsciiParser.RecordParser
fieldCount
in interface AsciiParser.RecordParser
public java.lang.String readNextRecord(java.io.BufferedReader reader) throws java.io.IOException
AsciiParser.RecordParser
readNextRecord
in interface AsciiParser.RecordParser
java.io.IOException
public final boolean tryParseRecord(java.lang.String line, int irec, DataSetBuilder builder)
AsciiParser.RecordParser
tryParseRecord
in interface AsciiParser.RecordParser
line
- the line from the file.irec
- the record numberbuilder
- the builder into which the data is inserted.public int fieldCount(java.lang.String line)
AsciiParser.RecordParser
fieldCount
in interface AsciiParser.RecordParser
line
- the line from the file, to attempt parsing.public java.lang.String[] fields(java.lang.String line)
public boolean splitRecord(java.lang.String line, java.lang.String[] fields)
AsciiParser.RecordParser
splitRecord
in interface AsciiParser.RecordParser
line
- the line from the file.fields
- array to store the fields. fieldCount() should be used
to determine the length of the array.