gov.nasa.gsfc.drl.rtstps.core.ccsds.path
Class PacketZone

java.lang.Object
  extended by gov.nasa.gsfc.drl.rtstps.core.ccsds.path.PacketZone

final class PacketZone
extends java.lang.Object

This class contains the packet zone part of a VCDU. We use it in packet reassembly to move bytes to packets and to maintain our current location within the packet zone. It does not contain the first header pointer. This class is reuseable.


Field Summary
private  byte[] data
           
private  int index
           
private  int remainingBytes
           
private  int zoneEnd
           
private  int zoneStart
           
 
Constructor Summary
PacketZone()
           
 
Method Summary
(package private)  void advance(int bytes)
          Advance the current location.
(package private)  void clear()
          Empty the zone.
(package private)  int getRemainingByteCount()
          Get the number of remaining bytes in the zone.
(package private)  int getWord(int offset)
          Get a 16-bit word from the zone starting at a byte offset from the current index.
(package private)  int moveRemainderTo(byte[] target, int start)
          Move all remaining bytes to a target buffer.
(package private)  void moveTo(byte[] target, int start, int length)
          Move some packet zone bytes (starting at the current zone index) to a target buffer.
(package private)  void reload(byte[] data, int start, int end)
          Use this method to load a new packet zone into this class.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

data

private byte[] data

zoneStart

private int zoneStart

zoneEnd

private int zoneEnd

index

private int index

remainingBytes

private int remainingBytes
Constructor Detail

PacketZone

PacketZone()
Method Detail

reload

void reload(byte[] data,
            int start,
            int end)
Use this method to load a new packet zone into this class. It resets all indicators.

Parameters:
data - The byte array that contains the packet zone.
start - Index of the beginning byte of the packet zone. Skip the first header pointer.
end - Index of the last byte of the packet zone.

getRemainingByteCount

final int getRemainingByteCount()
Get the number of remaining bytes in the zone.


clear

final void clear()
Empty the zone.


moveTo

void moveTo(byte[] target,
            int start,
            int length)
Move some packet zone bytes (starting at the current zone index) to a target buffer.


moveRemainderTo

int moveRemainderTo(byte[] target,
                    int start)
Move all remaining bytes to a target buffer. This method does not verify lengths.

Returns:
The number of bytes copied

getWord

final int getWord(int offset)
Get a 16-bit word from the zone starting at a byte offset from the current index.


advance

final void advance(int bytes)
Advance the current location.


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object