|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectpyrasun.eio.EIOInputBuffer
Abstracts out NIO reading and related buffer operations to make life slightly easier for for normal folk. Normally one of these is retrieved from ReadWriteEndpoint.getInputBuffer(). Instantiting one of these on your own would be - weird. This class does simple coordination between an underlying ByteBuffer, the Endpoint it's attached to, and a ByteBufferInputStream. The ByteBuffer can expand as needed according to what you set in setLimit() and resetFor()
| Constructor Summary | |
EIOInputBuffer(ReadWriteEndpoint endpoint)
Create an one of these buffers against the given endpoint. |
|
| Method Summary | |
void |
clear()
Clears out any old junk and gets us ready to pull more data off the channel. |
void |
ensure(int size)
Ensures that the underlying ByteBuffer has at least 'size' bytes. |
void |
ensure(int size,
boolean saveOld)
Ensures that the underlying ByteBuffer has at least 'size' bytes. |
void |
flip()
Flips the underlying ByteBuffer for reading by your application |
java.nio.ByteBuffer |
getByteBuffer()
Returns the underlying backing ByteBuffer. |
ByteBufferInputStream |
getInputStream()
Returns the ByteBufferInputStream associated with this guy and backed by the ByteBuffer. |
boolean |
read()
Reads data from the underlying channel into the internal ByteBufer here. |
void |
resetFor(int size)
Resets a partially used buffer for a bigger size, and preserves any data that's currently already in the buffer. |
void |
setLimit(int size)
Set the read limit for this buffer. |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public EIOInputBuffer(ReadWriteEndpoint endpoint)
| Method Detail |
public void setLimit(int size)
public void ensure(int size)
public void ensure(int size,
boolean saveOld)
public void flip()
public void resetFor(int size)
public boolean read()
throws java.io.IOException
java.io.IOExceptionpublic void clear()
public java.nio.ByteBuffer getByteBuffer()
public ByteBufferInputStream getInputStream()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||