More information: http://www.cs.berkeley.edu/~mdw/proj/seda/

seda.sandStorm.lib.aSocket
Class aSocketInputStream

java.lang.Object
  |
  +--java.io.InputStream
        |
        +--seda.nbio.NonblockingInputStream
              |
              +--seda.sandStorm.lib.util.MultiByteArrayInputStream
                    |
                    +--seda.sandStorm.lib.aSocket.aSocketInputStream

public class aSocketInputStream
extends seda.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

Inner Class Summary
(package private)  class aSocketInputStream.seqNumComparator
           
 
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 seda.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
 

Constructor Detail

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.
Method Detail

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 seda.sandStorm.lib.util.MultiByteArrayInputStream

getNextSequenceNumber

public long getNextSequenceNumber()
Return the next expected sequence number.

More information: http://www.cs.berkeley.edu/~mdw/proj/seda/