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

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

final class PacketCaddy
extends java.lang.Object

This class holds a Packet and is responsible for filling it with data.


Field Summary
private  int bytesToFill
           
private  byte[] data
           
private  FrameAnnotation frameAnnotationCopy
          This is a clone of the current packet's frame annotation.
private  int index
           
private  Packet packet
           
private  Packet.Annotation packetAnnotation
           
private  int packetLength
           
private  PathServiceSetup setup
           
 
Constructor Summary
PacketCaddy(PathServiceSetup setup)
          Construct the PacketCaddy.
 
Method Summary
(package private)  void appendHeader(SplitHeader header)
          Copy the packet header to the beginning of the current packet.
(package private)  int appendRestOfZone(PacketZone zone)
          Move all remaining data in the packet zone to the end of the current packet.
(package private)  void appendWaste()
          Finish filling the current packet repeatedly appending the waste byte to the packet.
(package private)  void finish(PacketZone zone)
          Finish filling the current packet by moving as much data as needed from the packet zone.
(package private)  int getBytesToFill()
          Get the number of bytes yet to fill in the current packet.
(package private)  void setAnotherFrameAnnotation(FrameAnnotation fa)
          I absorb another frame's annotation (its quality) into this packet's frame annotation.
(package private)  void setPacket(Packet p)
          Change the packet this caddy is filling.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

packet

private Packet packet

packetAnnotation

private Packet.Annotation packetAnnotation

packetLength

private int packetLength

index

private int index

data

private byte[] data

bytesToFill

private int bytesToFill

setup

private PathServiceSetup setup

frameAnnotationCopy

private FrameAnnotation frameAnnotationCopy
This is a clone of the current packet's frame annotation. Normally a packet uses the annotation from the first frame it came in, so I don't need this field, and it is often null. However, sometimes a packet that comes from multiple frames has different quality from different frames, which I must OR together, so I do this assembly in the clone. I cannot change fields in the packet's frame annotation because that object is very likely shared by other frames and packets.

Constructor Detail

PacketCaddy

PacketCaddy(PathServiceSetup setup)
Construct the PacketCaddy.

Parameters:
setup - A configuration.
Method Detail

getBytesToFill

final int getBytesToFill()
Get the number of bytes yet to fill in the current packet.


setPacket

void setPacket(Packet p)
Change the packet this caddy is filling.


setAnotherFrameAnnotation

void setAnotherFrameAnnotation(FrameAnnotation fa)
I absorb another frame's annotation (its quality) into this packet's frame annotation.


appendRestOfZone

int appendRestOfZone(PacketZone zone)
Move all remaining data in the packet zone to the end of the current packet. The method updates all indices.

Returns:
The number of bytes yet to fill in this packet after this move operation completes.

finish

void finish(PacketZone zone)
Finish filling the current packet by moving as much data as needed from the packet zone. The method updates all indices.


appendHeader

void appendHeader(SplitHeader header)
Copy the packet header to the beginning of the current packet.


appendWaste

void appendWaste()
Finish filling the current packet repeatedly appending the waste byte to the packet. The method updates the packet annotation too.