|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.apache.catalina.tribes.io.ObjectReader
public class 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.
This object uses an XByteBuffer which is an extendable object buffer that also allows
for message encoding and decoding.
| Field Summary | |
|---|---|
protected boolean |
accessed
|
protected long |
lastAccess
|
protected static Log |
log
|
| Constructor Summary | |
|---|---|
ObjectReader(java.net.Socket socket)
Creates an ObjectReader for a TCP socket |
|
ObjectReader(java.nio.channels.SocketChannel channel)
Creates an ObjectReader for a TCP NIO socket channel |
|
| Method Summary | |
|---|---|
void |
access()
|
int |
append(byte[] data,
int off,
int len,
boolean count)
|
int |
append(java.nio.ByteBuffer data,
int len,
boolean count)
Append new bytes to buffer. |
int |
bufferSize()
|
void |
close()
|
int |
count()
Returns the number of packages that the reader has read |
ChannelMessage[] |
execute()
Send buffer to cluster listener (callback). |
void |
finish()
|
long |
getLastAccess()
|
boolean |
hasPackage()
|
boolean |
isAccessed()
|
boolean |
isCancelled()
|
void |
setCancelled(boolean cancelled)
|
void |
setLastAccess(long lastAccess)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static Log log
protected long lastAccess
protected boolean accessed
| Constructor Detail |
|---|
public ObjectReader(java.nio.channels.SocketChannel channel)
ObjectReader for a TCP NIO socket channel
channel - - the channel to be read.public ObjectReader(java.net.Socket socket)
ObjectReader for a TCP socket
socket - Socket| Method Detail |
|---|
public void access()
public void finish()
public boolean isAccessed()
public int append(java.nio.ByteBuffer data,
int len,
boolean count)
throws java.io.IOException
data - new transfer bufferoff - offsetlen - length in buffer
java.io.IOExceptionXByteBuffer.countPackages()
public int append(byte[] data,
int off,
int len,
boolean count)
throws java.io.IOException
java.io.IOException
public ChannelMessage[] execute()
throws java.io.IOException
java.io.IOExceptionorg.apache.catalina.tribes.transport.ClusterReceiverBase#messageDataReceived(ChannelMessage),
XByteBuffer.doesPackageExist(),
XByteBuffer.extractPackage(boolean)public int bufferSize()
public boolean hasPackage()
public int count()
public void close()
public long getLastAccess()
public boolean isCancelled()
public void setLastAccess(long lastAccess)
public void setCancelled(boolean cancelled)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||