|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.io.InputStream
java.io.FilterInputStream
java.io.PushbackInputStream
com.ericdaugherty.mail.server.utils.DelimitedInputStream
public class DelimitedInputStream
This class adds to another InputStream the ability to read a line of bytes off the underlying stream source. The assumption is that the source bytes correspond to a sequence of characters. It is desirable in certain situations to be able to read a delimited series of bytes rather than have them converted to a stream of characters first, since it might be possible that the character set is unknown at a stage of the process or that the overhead needed to use the proper one is unacceptable or that it simply is not neccessary to have the bytes converted to characters. One such case is when JES reads a message from an I/O source where the EOL is platform-dependent.
Field Summary | |
---|---|
protected byte[] |
delimiter
A byte array corresponding to an EOL |
protected int |
maxBufferSize
The size of the pushback buffer |
protected boolean |
twoByteDelimiter
A flag to indicate the size of the EOL |
Fields inherited from class java.io.PushbackInputStream |
---|
buf, pos |
Fields inherited from class java.io.FilterInputStream |
---|
in |
Constructor Summary | |
---|---|
DelimitedInputStream(java.io.InputStream in)
A constructor using a fixed buffer size |
|
DelimitedInputStream(java.io.InputStream in,
byte[] delimiter)
A constructor using an application defined delimiter and a fixed buffer size |
|
DelimitedInputStream(java.io.InputStream in,
int maxBufferSize)
A constructor using an application defined buffer size |
|
DelimitedInputStream(java.io.InputStream in,
int maxBufferSize,
byte[] delimiter)
A constructor using an application defined buffer size and delimiter |
Method Summary | |
---|---|
byte[] |
readLine()
The method to extract a single line of bytes |
Methods inherited from class java.io.PushbackInputStream |
---|
available, close, mark, markSupported, read, read, reset, skip, unread, unread, unread |
Methods inherited from class java.io.FilterInputStream |
---|
read |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final byte[] delimiter
protected final boolean twoByteDelimiter
protected final int maxBufferSize
Constructor Detail |
---|
public DelimitedInputStream(java.io.InputStream in) throws java.io.IOException
java.io.IOException
public DelimitedInputStream(java.io.InputStream in, byte[] delimiter) throws java.io.IOException
java.io.IOException
public DelimitedInputStream(java.io.InputStream in, int maxBufferSize) throws java.io.IOException
java.io.IOException
public DelimitedInputStream(java.io.InputStream in, int maxBufferSize, byte[] delimiter) throws java.io.IOException
java.io.IOException
Method Detail |
---|
public byte[] readLine() throws java.io.IOException
java.io.IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |