|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jwall.web.http.nio.BufferedReadableByteChannel
public class BufferedReadableByteChannel
This class implements a few convenient methods, mainly for reading a newline terminated line from a channel. It relies on a standard readable byte channel provided by a number of JDK classes, which are given to the constructor at creation time.
| Constructor Summary | |
|---|---|
BufferedReadableByteChannel(ReadableByteChannel input)
This constructor creates a new instance of this class with an internal buffer of 32k bytes. |
|
BufferedReadableByteChannel(ReadableByteChannel input,
int bufSize)
This constructor creates a new instance of this class with an internal buffer of the given buffer-size. |
|
| Method Summary | |
|---|---|
void |
close()
|
boolean |
isOpen()
|
int |
read(ByteBuffer dst)
|
String |
readLine()
This method tries to read a full line, terminated by a \n newline
character, from the currently available bytes. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public BufferedReadableByteChannel(ReadableByteChannel input)
input - The byte-channel this instance reads from.
public BufferedReadableByteChannel(ReadableByteChannel input,
int bufSize)
input - bufSize - | Method Detail |
|---|
public String readLine()
throws IOException
\n newline
character, from the currently available bytes. If there can no complete line
be read (i.e. no newline char in the buffer), then the method transfers the
currently available bytes into a "partial complete line" and immediately
returns null.
null if no complete line can be read
from the currently available bytes.
IOExecption - in case
IOException
public int read(ByteBuffer dst)
throws IOException
read in interface ReadableByteChannelIOException
public void close()
throws IOException
close in interface Closeableclose in interface ChannelIOExceptionChannel.close()public boolean isOpen()
isOpen in interface ChannelChannel.isOpen()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||