gov.nasa.gsfc.drl.rtstps.core
Class Unit

java.lang.Object
  extended by gov.nasa.gsfc.drl.rtstps.core.Unit
Direct Known Subclasses:
BitstreamService.B_PDU, Cadu, Frame, Packet, VcduService.Vcdu

public abstract class Unit
extends java.lang.Object

This abstract class is the base class for all units, such as packets, frames, etc.


Field Summary
protected  byte[] data
          The unit's data by default is stored in this array.
protected  boolean deleted
          When true, this unit is marked as deleted.
protected  FrameAnnotation frameAnnotation
          All units that we use are derived from frames, so each unit has associated frame annotation.
protected  int length
          Some units are shorter than the full data array length.
protected  int startOffset
          Some units do not begin at byte offset zero of the data array.
 
Constructor Summary
protected Unit()
          Create a unit.
protected Unit(int length)
          Create a unit.
 
Method Summary
 byte[] getData()
          Get this unit's data.
 FrameAnnotation getFrameAnnotation()
          Get this unit's frame annotation.
 int getSize()
          Get this unit's actual size in bytes.
 int getStartOffset()
          Get this unit's start offset within its byte array.
 boolean isDeleted()
          Determine if this is a deleted frame.
 void setDeleted(boolean d)
          Mark this unit as deleted or not deleted.
 void setFrameAnnotation(FrameAnnotation a)
          Set this unit's frame annotation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

frameAnnotation

protected FrameAnnotation frameAnnotation
All units that we use are derived from frames, so each unit has associated frame annotation.


data

protected byte[] data
The unit's data by default is stored in this array.


startOffset

protected int startOffset
Some units do not begin at byte offset zero of the data array. This is the unit's starting byte offset.


length

protected int length
Some units are shorter than the full data array length. This is the unit's actual length.


deleted

protected boolean deleted
When true, this unit is marked as deleted. In almost all cases, all classes skip deleted frames. (One known exception is CCSDS v2 fill frames, which are deleted. They may contains valid insert zone data.)

Constructor Detail

Unit

protected Unit(int length)
Create a unit.

Parameters:
length - The number of bytes to be allocated to the unit.

Unit

protected Unit()
Create a unit. This constructor version does not allocate memory for the data.

Method Detail

getStartOffset

public final int getStartOffset()
Get this unit's start offset within its byte array.


getFrameAnnotation

public final FrameAnnotation getFrameAnnotation()
Get this unit's frame annotation.


setFrameAnnotation

public void setFrameAnnotation(FrameAnnotation a)
Set this unit's frame annotation.


getData

public final byte[] getData()
Get this unit's data.


getSize

public final int getSize()
Get this unit's actual size in bytes. The actual size may be less than the data array size.


setDeleted

public void setDeleted(boolean d)
Mark this unit as deleted or not deleted.


isDeleted

public final boolean isDeleted()
Determine if this is a deleted frame.