|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.catalina.cluster.io.ObjectReader
The object reader object is an object used in conjunction with
java.nio TCP messages. This object stores the message bytes in a
XByteBuffer
until a full package has been received.
When a full package has been received, the append method will call messageDataReceived
on the callback object associated with this object reader.
This object uses an XByteBuffer which is an extendable object buffer that also allows
for message encoding and decoding.
Constructor Summary | |
ObjectReader(java.nio.channels.SocketChannel channel,
java.nio.channels.Selector selector,
ListenCallback callback)
Create XByteBuffer and store parameter |
Method Summary | |
int |
append(byte[] data,
int off,
int len)
Append new bytes to buffer. |
int |
execute()
Send buffer to cluster listener (callback). |
ListenCallback |
getCallback()
get the current SimpleTcpCluster |
java.nio.channels.SocketChannel |
getChannel()
Get underlying NIO channel |
int |
write(java.nio.ByteBuffer buf)
Write Ack to sender |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public ObjectReader(java.nio.channels.SocketChannel channel, java.nio.channels.Selector selector, ListenCallback callback)
channel
- selector
- callback
- Method Detail |
public ListenCallback getCallback()
public java.nio.channels.SocketChannel getChannel()
public int append(byte[] data, int off, int len) throws java.io.IOException
data
- new transfer bufferoff
- offsetlen
- length in buffer
java.io.IOException
XByteBuffer.countPackages()
public int execute() throws java.io.IOException
java.io.IOException
ClusterReceiverBase.messageDataReceived(ClusterData)
,
XByteBuffer.doesPackageExist()
,
XByteBuffer.extractPackage(boolean)
public int write(java.nio.ByteBuffer buf) throws java.io.IOException
buf
-
java.io.IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |