Package org.apache.james.mime4j.io
Class LineReaderInputStreamAdaptor
java.lang.Object
java.io.InputStream
java.io.FilterInputStream
org.apache.james.mime4j.io.LineReaderInputStream
org.apache.james.mime4j.io.LineReaderInputStreamAdaptor
- All Implemented Interfaces:
Closeable
,AutoCloseable
InputStream
used by the MIME parser to detect whether the
underlying data stream was used (read from) and whether the end of the
stream was reached.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final LineReaderInputStream
private boolean
private final int
private boolean
Fields inherited from class java.io.FilterInputStream
in
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate int
boolean
eof()
boolean
isUsed()
int
read()
int
read
(byte[] b, int off, int len) int
readLine
(ByteArrayBuffer dst) Reads one line of text into the givenByteArrayBuffer
.long
skip
(long count) toString()
boolean
unread
(ByteArrayBuffer buf) Tries to unread the last read line.boolean
Methods inherited from class java.io.FilterInputStream
available, close, mark, markSupported, read, reset
Methods inherited from class java.io.InputStream
nullInputStream, readAllBytes, readNBytes, readNBytes, skipNBytes, transferTo
-
Field Details
-
bis
-
maxLineLen
private final int maxLineLen -
used
private boolean used -
eof
private boolean eof
-
-
Constructor Details
-
LineReaderInputStreamAdaptor
-
LineReaderInputStreamAdaptor
-
-
Method Details
-
read
- Overrides:
read
in classFilterInputStream
- Throws:
IOException
-
read
- Overrides:
read
in classFilterInputStream
- Throws:
IOException
-
readLine
Description copied from class:LineReaderInputStream
Reads one line of text into the givenByteArrayBuffer
.- Specified by:
readLine
in classLineReaderInputStream
- Parameters:
dst
- Destination- Returns:
- number of bytes copied or
-1
if the end of the stream has been reached. - Throws:
MaxLineLimitException
- if the line exceeds a limit on the line length imposed by a subclass.IOException
- in case of an I/O error.
-
doReadLine
- Throws:
MaxLineLimitException
IOException
-
eof
public boolean eof() -
isUsed
public boolean isUsed() -
toString
-
unread
Description copied from class:LineReaderInputStream
Tries to unread the last read line. Implementation may refuse to unread a new buffer until the previous unread one has been competely consumed. Implementations will directly use the byte array backed by buf, so make sure to not alter it anymore once this method has been called.- Specified by:
unread
in classLineReaderInputStream
- Returns:
- true if the unread has been succesfull.
-
unread
- Specified by:
unread
in classLineReaderInputStream
-
skip
- Overrides:
skip
in classFilterInputStream
- Throws:
IOException
-