public class FixedLengthReader extends Object implements RecordReader
String
class. Records must be terminated by a single
configurable character, or by default, any of the following: line feed (LF),
carriage return (CR), or CRLF combination.
If a record may span multiple lines, a single line continuation character may be configured. The line continuation character must immediately precede the record termination character. Note that line continuation characters are not included in the record text.
Constructor and Description |
---|
FixedLengthReader(Reader in)
Constructs a new FixedLengthReader.
|
FixedLengthReader(Reader in,
FixedLengthParserConfiguration config)
Constructs a new FixedLengthReader.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes this input stream.
|
int |
getRecordLineNumber()
Returns the line number of the last record from this input stream.
|
String |
getRecordText()
Returns the unparsed record text of the last record read.
|
String |
read()
Reads a single record from this input stream.
|
public FixedLengthReader(Reader in)
in
- the input stream to read frompublic FixedLengthReader(Reader in, FixedLengthParserConfiguration config) throws IllegalArgumentException
in
- the input stream to read fromconfig
- the reader configuration settings or null to accept defaultsIllegalArgumentException
- if a configuration setting is invalidpublic int getRecordLineNumber()
RecordReader
getRecordLineNumber
in interface RecordReader
public String getRecordText()
RecordReader
getRecordText
in interface RecordReader
public String read() throws IOException, RecordIOException
RecordReader
read
in interface RecordReader
IOException
- if an I/O error occurs reading from the streamRecordIOException
- if the record is malformed and cannot
be parsed, but subsequent reads may still be possiblepublic void close() throws IOException
RecordReader
close
in interface RecordReader
IOException
- if an I/O error occurs closing the stream