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

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

public class CopyPacket
extends java.lang.Object

Utility class to make a deep copy of a Packet. This class is needed to specifically support this package being included in the RT-STPS processing chain because RT-STPS caches its outgoing packets on a local list and cannot guarantee they won't be used once the main processing loop has been iterated over. Since several part of this package hold onto packets in internal lists, a copy is needed in order for this to work within RT-STPS. If this module is stand-alone, then a copy of input packet is not necessary as long as any packet reader does not assume it can reuse a packet object it creates. In order to have some efficiency the Packet is taken from a Packet pool. The pool creates new Packets if there are not any. When the packet is not longer being used, the deep copied packet this class returns should be put back on the PacketPool.


Constructor Summary
CopyPacket()
           
 
Method Summary
static Packet deep(Packet source, PacketPool packetPool)
          Deep copy an input Packet
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CopyPacket

public CopyPacket()
Method Detail

deep

public static Packet deep(Packet source,
                          PacketPool packetPool)
                   throws RtStpsException
Deep copy an input Packet

Parameters:
source - an input Packet
Returns:
the deep copied packet
Throws:
RtStpsException - an exception from the PacketPool