|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.sun.sgs.impl.io.CompleteMessageFilter
class CompleteMessageFilter
This filter guarantees that only complete messages are delivered to its
FilterListener.
It prepends the message length on sending, and reads the length of each
message on receiving. If the message is partial, the filter will hold the
partial message until the rest of the message is received, even if the
message spans multiple calls to filterReceive.
The filterReceive portion of this filter is not thread-safe since
it retains state information about partial messages. For this reason,
each source of data should have its own instance, and filterReceive
should be called by only one thread at a time.
filterSend, however, is thread-safe.
| Constructor Summary | |
|---|---|
CompleteMessageFilter()
Default constructor. |
|
| Method Summary | |
|---|---|
(package private) void |
filterReceive(FilterListener listener,
org.apache.mina.common.ByteBuffer buf)
Processes network data of arbitrary length and dispatches zero or more complete messages to the given listener. |
(package private) void |
filterSend(FilterListener listener,
byte[] message)
Prepends the length of the given byte array as a 2-byte short
in network byte-order, and passes the result to the sendUnfiltered method of the
given listener. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
CompleteMessageFilter()
| Method Detail |
|---|
void filterReceive(FilterListener listener,
org.apache.mina.common.ByteBuffer buf)
listener. If a partial
message remains, it is buffered until more data is received.
listener - the FilterListener to receive complete messagesbuf - the data to filter and optionally deliver to the
FilterListener
void filterSend(FilterListener listener,
byte[] message)
short
in network byte-order, and passes the result to the sendUnfiltered method of the
given listener.
listener - the FilterListener on which to send the datamessage - the data to filter and forward to the listener
|
Project Darkstar, Version 0.9.10.12 2013-07-29 21:37:44 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||