|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.khelekore.rnio.impl.SocketHandlerBase<SocketChannel> org.khelekore.rnio.impl.SimpleBlockReader
public abstract class SimpleBlockReader
A reader of data. Will wait until a channel is read-ready and then read a block of data from it.
Field Summary |
---|
Fields inherited from class org.khelekore.rnio.impl.SocketHandlerBase |
---|
nioHandler, sc, timeout |
Constructor Summary | |
---|---|
SimpleBlockReader(SocketChannel sc,
NioHandler nioHandler,
Long timeout)
Create a new block reader. |
Method Summary | |
---|---|
abstract void |
channelClosed()
Do any cleanup that needs to be done when the channel we tried to read from was closed. |
ByteBuffer |
getByteBuffer()
Called before a read attempt is made. |
abstract void |
handleBufferRead(ByteBuffer buf)
Handle the buffer content. |
void |
handleIOException(IOException e)
Handle the exception, default is to log it and to close the channel. |
void |
putByteBuffer(ByteBuffer buf)
Return the ByteBuffer, this method will be called when read gets EOF or no data. |
void |
read()
Try to read data from the channel. |
void |
register()
Wait for the channel to become read ready. |
Methods inherited from class org.khelekore.rnio.impl.SocketHandlerBase |
---|
closed, getDescription, getTimeout, timeout, useSeparateThread |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.khelekore.rnio.SocketChannelHandler |
---|
closed, getDescription, getTimeout, timeout, useSeparateThread |
Constructor Detail |
---|
public SimpleBlockReader(SocketChannel sc, NioHandler nioHandler, Long timeout)
sc
- the channel to read fromnioHandler
- the NioHandler to use for waiting on datatimeout
- the timeout time, may be null if not timeout is setMethod Detail |
---|
public void read()
read
in interface ReadHandler
public ByteBuffer getByteBuffer()
public void putByteBuffer(ByteBuffer buf)
public void handleIOException(IOException e)
public abstract void channelClosed()
public abstract void handleBufferRead(ByteBuffer buf) throws IOException
IOException
public void register()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |