|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.io.InputStream
java.io.FilterInputStream
ccs.utils.LineInputStream
public class LineInputStream
This filter returns its underlying stream a single "line" at a time.
Specifically, the bytestring returned from the read(byte, int, int)
method is guaranteed to obey one of these criteria:
Field Summary | |
---|---|
static int |
BUFLEN
The length of the internal buffer. |
Fields inherited from class java.io.FilterInputStream |
---|
in |
Constructor Summary | |
---|---|
LineInputStream(java.io.InputStream in)
Create a LineInputStream for the specified InputStream, without anal CRLF checking. |
|
LineInputStream(java.io.InputStream in,
boolean isAnalCRLF)
Create a LineInputStream for the InputStream with settable "anal CRLF Checking". |
Method Summary | |
---|---|
boolean |
isEOF()
Whether there is an EOF condition. |
int |
read()
This method is incompatible with the contract of the stream - it's supposed to return a line at a time, not a byte at a time. |
int |
read(byte[] wad,
int off,
int len)
Returns the next "line" - as defined in the preamble - or as much of it as fits in the method's internal buffer. |
java.lang.String |
readAscii()
Returns the next line as a String, assuming that the data is ASCII. |
void |
setDam(int damleft)
Sets a dam. |
Methods inherited from class java.io.FilterInputStream |
---|
available, close, mark, markSupported, read, reset, skip |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int BUFLEN
read(byte[], int, int)
,
Constant Field ValuesConstructor Detail |
---|
public LineInputStream(java.io.InputStream in)
public LineInputStream(java.io.InputStream in, boolean isAnalCRLF)
UTFDataFormatException
(which is slightly wonky, but what the heck.)
Method Detail |
---|
public void setDam(int damleft)
read
, when damleft
bytes have been returned, the stream will report EOF. This is used to e.g.
not make socket streams block. NB. Due to the internal buffering used by this
stream, it is generally not sufficient to feed a DammedInputStream
from this stream, hence this apparent duplication of functionality. (The opposite
configuration - feeding this from a DammedInputStream
- is OK.)
To disable the dam, set it to < 0.
public int read() throws java.io.IOException
read
in class java.io.FilterInputStream
java.io.IOException
public int read(byte[] wad, int off, int len) throws java.io.IOException
BUFLEN
bytes.
read
in class java.io.FilterInputStream
java.io.IOException
public java.lang.String readAscii() throws java.io.IOException
java.io.UTFDataFormatException
- If anal CRLF checking is enabled and the
line does not comply.
java.io.IOException
public boolean isEOF()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |