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()
RecordReadergetRecordLineNumber in interface RecordReaderpublic String getRecordText()
RecordReadergetRecordText in interface RecordReaderpublic String read() throws IOException, RecordIOException
RecordReaderread in interface RecordReaderIOException - 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
RecordReaderclose in interface RecordReaderIOException - if an I/O error occurs closing the stream