gov.nasa.gsfc.drl.rtstps.core.output.hdf5
Class SequentialPacketReader

java.lang.Object
  extended by gov.nasa.gsfc.drl.rtstps.core.output.hdf5.SequentialPacketReader
All Implemented Interfaces:
java.util.Iterator<PacketI>

public class SequentialPacketReader
extends java.lang.Object
implements java.util.Iterator<PacketI>

Using the StaticHeader of a particular RawApplicationPackets item, read the contents using a sequential access style interface. This class simply indexes into the StaticHeader packet region and read each packet in a sequential manner. Note that this classes constructor is package private, and a method in each StaticHeader must be used to create it.


Field Summary
private  byte[] data
           
private  PacketFactoryI factory
           
private  int index
           
 
Constructor Summary
SequentialPacketReader(PacketFactoryI factory, StaticHeader staticHeader)
          Make a new reader by providing PacketFactory (some way to create new Packets) and the StaticHeader of interest
 
Method Summary
private  int getAppID()
           
 int getDataLength()
           
 int getIndex()
           
private  int getPacketLength()
           
private  int getPacketSize()
           
 boolean hasNext()
          Return true or false if another packet is available
 PacketI next()
          Return a Packet constructed from an index into the buffer
 void remove()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

factory

private PacketFactoryI factory

data

private byte[] data

index

private int index
Constructor Detail

SequentialPacketReader

SequentialPacketReader(PacketFactoryI factory,
                       StaticHeader staticHeader)
Make a new reader by providing PacketFactory (some way to create new Packets) and the StaticHeader of interest

Parameters:
packetFactory - a way to create new Packets
staticHeader - the StaticHeader from a RawApplicationsPackets of interest
Method Detail

getIndex

public int getIndex()

getDataLength

public int getDataLength()

next

public PacketI next()
Return a Packet constructed from an index into the buffer

Specified by:
next in interface java.util.Iterator<PacketI>
Returns:
the next Packet

hasNext

public boolean hasNext()
Return true or false if another packet is available

Specified by:
hasNext in interface java.util.Iterator<PacketI>

remove

public void remove()
Specified by:
remove in interface java.util.Iterator<PacketI>

getAppID

private int getAppID()

getPacketLength

private int getPacketLength()

getPacketSize

private int getPacketSize()