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

java.lang.Object
  extended by gov.nasa.gsfc.drl.rtstps.core.output.hdf5.ApStorageArea

public class ApStorageArea
extends java.lang.Object

Write or read packets from the ApStorageArea area


Field Summary
private  byte[] data
           
private  int offset
           
private  java.util.List<Packet> packets
           
 
Constructor Summary
ApStorageArea(byte[] data, int offset)
          Constructor to read out of the ApStorage area, use this conjunction with the read method below.
ApStorageArea(java.util.List<Packet> packets)
          Constructor for manipulating the ApStorageArea, in preparation for writing to a memory block through the write method.
 
Method Summary
 java.util.List<Packet> read(int offset, int size)
          Read up to size amount of packets.
 int write(byte[] data, int offset)
          Write the packet list to the specified data buffer at the given offset.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

packets

private java.util.List<Packet> packets

offset

private int offset

data

private byte[] data
Constructor Detail

ApStorageArea

public ApStorageArea(java.util.List<Packet> packets)
Constructor for manipulating the ApStorageArea, in preparation for writing to a memory block through the write method. Use this in conjunction with the write method.

Parameters:
packets - a list of packets to write

ApStorageArea

public ApStorageArea(byte[] data,
                     int offset)
Constructor to read out of the ApStorage area, use this conjunction with the read method below.

Parameters:
data - a byte array of packet data, including header of ApStorage area
offset - an offset into the array where the packet data starts
Method Detail

read

public java.util.List<Packet> read(int offset,
                                   int size)
Read up to size amount of packets. Note that this assumes the packets are uniform in the data. The packet data is not copied.

Parameters:
offset - an offset past the header in the ApStorage area to the raw data
size - the amount to read in bytes
Returns:
packets a list of new Packets containing the data -- note the data is not copied into the new packets but simply points to it

write

public int write(byte[] data,
                 int offset)
Write the packet list to the specified data buffer at the given offset. The data buffer is assumed to be of sufficient size to fit the packets.

Parameters:
data - the data to be written
offset - an offset into that data
Returns:
the new offset after the data written