mdw.sandStorm.lib.aSocket
Class aSocketInputStream
java.lang.Object
|
+--java.io.InputStream
|
+--mdw.nbio.NonblockingInputStream
|
+--mdw.sandStorm.lib.util.MultiByteArrayInputStream
|
+--mdw.sandStorm.lib.aSocket.aSocketInputStream
- public class aSocketInputStream
- extends mdw.sandStorm.lib.util.MultiByteArrayInputStream
This is a utility class that allows you to push multiple ATcpInPackets
in, and read bytes out as a stream. This is meant to be a convenience
for performing packet processing using the aSocket interfaces.
This class also takes care of reordering packets according to the
ATcpInPacket sequence number; that is, if multiple threads in a stage
are receiving ATcpInPackets for the same connection, the aSocketInputStream
will internally reorder those packets.
- Author:
- Matt Welsh
- See Also:
MultiByteArrayInputStream
Constructor Summary |
aSocketInputStream()
Create an aSocketInputStream with an initial sequence number of 1. |
aSocketInputStream(long initialSeqNum)
Create an aSocketInputStream using the given initial sequence number. |
Method Summary |
void |
addPacket(ATcpInPacket pkt)
Add a packet to this aSocketInputStream. |
void |
clear()
Reinitialize the state of this input stream, clearing all
internal data and pointers. |
long |
getNextSequenceNumber()
Return the next expected sequence number. |
Methods inherited from class mdw.sandStorm.lib.util.MultiByteArrayInputStream |
addArray, available, close, mark, markSupported, nbRead, numArrays, read, read, read, reset, skip |
Methods inherited from class java.lang.Object |
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
aSocketInputStream
public aSocketInputStream()
- Create an aSocketInputStream with an initial sequence number of 1.
aSocketInputStream
public aSocketInputStream(long initialSeqNum)
- Create an aSocketInputStream using the given initial sequence number.
addPacket
public void addPacket(ATcpInPacket pkt)
- Add a packet to this aSocketInputStream. Reorders packets internally
so that bytes will be read from this InputStream according to the
sequence number order of the packets.
clear
public void clear()
- Reinitialize the state of this input stream, clearing all
internal data and pointers. The next sequence number will
be preserved.
- Overrides:
clear
in class mdw.sandStorm.lib.util.MultiByteArrayInputStream
getNextSequenceNumber
public long getNextSequenceNumber()
- Return the next expected sequence number.