cnrg.itx.datax.devices
Class FECBuffer

java.lang.Object
  |
  +--cnrg.itx.datax.devices.FECBuffer

class FECBuffer
extends java.lang.Object

Class to implement the forward error correction mechanism. This class will be used to construct FEC buffers from single byte buffers. (July 1999 addition) No created buffer will be less than 1 byte in size.


Field Summary
(package private)  byte[][] fecBuffer
          Attribute for storing the previous packets sent for Forward Error Correction.
private  int iPacketSize
          attribute to hold packet size.
private static int numFECPackets
          Constant for specifying the number of packets to be used for Forward Error Correction.
private static byte SILENCE
          Constant for the value of a silence byte.
 
Constructor Summary
FECBuffer(int iPacketSize)
          Default constructor for the FECBuffer object.
 
Method Summary
 byte[] getBuffer(int index)
          Method to get one of the buffers from the FEC buffer.
 int getNumFECPackets()
          Accessor to get the number of FEC packets.
private  short getShort(byte[] packet, int pos)
          Method to get a short(16 bit) value from a position in a byte array.
 byte[] pack(byte[] packet)
          Method to construct a FEC packet from a buffer.
private  void setShort(byte[] packet, int pos, short value)
          Method to set a short(16 bit) value in a byte array.
 byte[] unpack(byte[] fecPacket)
          Method to put in a FEC packet and split it into its components.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

numFECPackets

private static final int numFECPackets
Constant for specifying the number of packets to be used for Forward Error Correction.

fecBuffer

byte[][] fecBuffer
Attribute for storing the previous packets sent for Forward Error Correction.

iPacketSize

private int iPacketSize
attribute to hold packet size.

SILENCE

private static final byte SILENCE
Constant for the value of a silence byte.
Constructor Detail

FECBuffer

public FECBuffer(int iPacketSize)
Default constructor for the FECBuffer object.
Method Detail

getNumFECPackets

public int getNumFECPackets()
Accessor to get the number of FEC packets.
Returns:
int the number of FEC packets

getBuffer

public byte[] getBuffer(int index)
Method to get one of the buffers from the FEC buffer.
Parameters:
index - the index of the buffer to get
Returns:
byte[] the corresponding byte array for the buffer

pack

public byte[] pack(byte[] packet)
Method to construct a FEC packet from a buffer.
Parameters:
packet - the buffer that needs to be forward error corrected
Returns:
byte[] the forward error corrected byte array

unpack

public byte[] unpack(byte[] fecPacket)
Method to put in a FEC packet and split it into its components.
Parameters:
fecPacket - the byte array for all the packets
Returns:
byte[] the primary packet from the FEC array

setShort

private void setShort(byte[] packet,
                      int pos,
                      short value)
Method to set a short(16 bit) value in a byte array.
Parameters:
packet - the byte array to put the value in
pos - the position at which the bytes need to be put
value - the short value to be put

getShort

private short getShort(byte[] packet,
                       int pos)
Method to get a short(16 bit) value from a position in a byte array.
Parameters:
packet - the byte array to get the value from
pos - the position from which to get the 16 bit value