|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.io.InputStream
java.io.FilterInputStream
com.mckoi.util.LengthMarkedBufferedInputStream
public final class LengthMarkedBufferedInputStream
Reads a command block on the underlying stream that is constrained by a length marker preceeding the command. This can be used as a hack work around for non-blocking IO because we know ahead of time how much data makes up the next block of information over the stream.
| Constructor Summary | |
|---|---|
LengthMarkedBufferedInputStream(java.io.InputStream in)
The Constructor. |
|
| Method Summary | |
|---|---|
int |
available()
|
void |
blockForCommand()
Blocks until a complete command has been read in. |
boolean |
markSupported()
|
boolean |
pollForCommand(int max_size)
Checks to see if there is a complete command waiting on the input stream. |
int |
read()
|
int |
read(byte[] b,
int off,
int len)
|
| Methods inherited from class java.io.FilterInputStream |
|---|
close, mark, read, reset, skip |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public LengthMarkedBufferedInputStream(java.io.InputStream in)
| Method Detail |
|---|
public int read()
throws java.io.IOException
read in class java.io.FilterInputStreamjava.io.IOException
public int read(byte[] b,
int off,
int len)
throws java.io.IOException
read in class java.io.FilterInputStreamjava.io.IOException
public int available()
throws java.io.IOException
available in class java.io.FilterInputStreamjava.io.IOExceptionpublic boolean markSupported()
markSupported in class java.io.FilterInputStream
public boolean pollForCommand(int max_size)
throws java.io.IOException
'max_size' is the maximum number of bytes we are allowing before an IOException is thrown.
java.io.IOException
public void blockForCommand()
throws java.io.IOException
java.io.IOException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||