|
Apache Tomcat 7.0.28 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.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
|
Constructor Summary | |
---|---|
ObjectReader(int packetSize)
|
|
ObjectReader(Socket socket)
Creates an ObjectReader for a TCP socket |
|
ObjectReader(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(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 long lastAccess
protected boolean accessed
Constructor Detail |
---|
public ObjectReader(int packetSize)
public ObjectReader(SocketChannel channel)
ObjectReader
for a TCP NIO socket channel
channel
- - the channel to be read.public ObjectReader(Socket socket)
ObjectReader
for a TCP socket
socket
- SocketMethod Detail |
---|
public void access()
public void finish()
public boolean isAccessed()
public int append(ByteBuffer data, int len, boolean count) throws IOException
data
- new transfer bufferlen
- length in buffercount
- whether to return the count
IOException
XByteBuffer.countPackages()
public int append(byte[] data, int off, int len, boolean count) throws IOException
IOException
public ChannelMessage[] execute() throws IOException
IOException
ReceiverBase.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)
|
Apache Tomcat 7.0.28 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |