|
BeanIO 1.2.3 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.beanio.stream.fixedlength.FixedLengthReader
public class FixedLengthReader
A FixedLengthReader is used to read records from a fixed length
file or input stream. A fixed length record is represented using the
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 Summary | |
---|---|
FixedLengthReader(Reader in)
Constructs a new FixedLengthReader. |
|
FixedLengthReader(Reader in,
Character lineContinuationCharacter)
Deprecated. use FixedLengthReader(Reader, FixedLengthReaderConfiguration) instead |
|
FixedLengthReader(Reader in,
Character lineContinuationCharacter,
Character recordTerminator)
Deprecated. use FixedLengthReader(Reader, FixedLengthReaderConfiguration) instead |
|
FixedLengthReader(Reader in,
FixedLengthReaderConfiguration config)
Constructs a new FixedLengthReader. |
Method Summary | |
---|---|
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public FixedLengthReader(Reader in)
in
- the input stream to read frompublic FixedLengthReader(Reader in, Character lineContinuationCharacter)
FixedLengthReader(Reader, FixedLengthReaderConfiguration)
instead
in
- the input stream to read fromlineContinuationCharacter
- the line continuation character,
or null to disable line continuationspublic FixedLengthReader(Reader in, Character lineContinuationCharacter, Character recordTerminator)
FixedLengthReader(Reader, FixedLengthReaderConfiguration)
instead
in
- the input stream to read fromlineContinuationCharacter
- the line continuation character,
or null to disable line continuationsrecordTerminator
- the character used to signify the end of a recordpublic FixedLengthReader(Reader in, FixedLengthReaderConfiguration config) throws IllegalArgumentException
in
- the input stream to read fromconfig
- the reader configuration settings or null to accept defaults
IllegalArgumentException
- if a configuration setting is invalidMethod Detail |
---|
public 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 stream
RecordIOException
- 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
|
BeanIO 1.2.3 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |