public class ConcatenatedDisPdus
extends java.lang.Object
It's not uncommon to place serveral PDUs in a single datagram packet, since placing one in each datagram can cause a very heavy network load. This class is useful for extracting the PDUs from that one big byte array. It's also not uncommon to see people simply write out IEEE PDUs in a file, one after the other. It's a useful format, but then you need to read it back, which is what this does.
This also includes an "index" method that returns a big array with the input stream pointer position of the start of each PDU. This is useful for indexing into the input stream for semi-random access to PDUs in the stream.
This class is too profliigate with memory and should be rewritten to take advantage of some NIO classes.
Constructor and Description |
---|
ConcatenatedDisPdus(java.io.InputStream is) |
Modifier and Type | Method and Description |
---|---|
java.util.List<Pdu> |
getAllPdus()
Returns a List of all the PDUs remaining in the input stream
|
PduContainer |
getAllPdusInPduContainer()
Returns all the PDUs in the concatenated PDU input stream, starting
with the current file position.
|
int[] |
getIndexes()
Returns an array of all the index positions in the input stream that
are the starting points for each PDU.
|
Pdu |
getNextPdu()
Ugh--this is memory inefficient and should be rewritten so that the
PDU factory can simply take an input stream.
|
static void |
main(java.lang.String[] args)
Useful for some testing, maybe some example code
|
public Pdu getNextPdu()
Note that this will fail horribly if the length field is wrong, or if any one of the length fields before this was wrong.
This depends on the input stream being open and not reset through multiple calls to getNextPdu().
public PduContainer getAllPdusInPduContainer()
public java.util.List<Pdu> getAllPdus()
public int[] getIndexes()
public static void main(java.lang.String[] args)
args
-