|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.nps.moves.disutil.ConcatenatedDisPdus
public class ConcatenatedDisPdus
Reads concatenated PDUs, not necessarily of the same type or the same length, from a binary file. The assumption is that the PDUs were placed in IEEE format, concatenated one after the other, into the file.
It's not uncommonn 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 Summary | |
---|---|
ConcatenatedDisPdus(java.io.InputStream is)
|
Method Summary | |
---|---|
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 |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ConcatenatedDisPdus(java.io.InputStream is)
Method Detail |
---|
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
-
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |