edu.iris.dmc.seedcodec
Class SteimFrameBlock

java.lang.Object
  extended by edu.iris.dmc.seedcodec.SteimFrameBlock

public class SteimFrameBlock
extends java.lang.Object

This class acts as a container to hold encoded bytes processed by a Steim compression routine, as well as supporting information relating to the data processed. It also facilitates Steim notation and the formation of the data frames. This class stores the Steim encoding, but is ignorant of the encoding process itself...it's just for self-referencing.


Constructor Summary
SteimFrameBlock(int numFrames, int steimVersion)
          Create a new block of Steim frames for a particular version of Steim copression.
 
Method Summary
protected  boolean addEncodedWord(int word, int samples, int nibble)
          Add a single 32-bit word to current frame.
 byte[] getEncodedData()
          Return the compressed byte representation of the data for inclusion in a data record.
 int getNumFrames()
          Return the number of frames in this frame block
 int getNumSamples()
          Return the number of data samples represented by this frame block
 edu.iris.dmc.seedcodec.SteimFrameBlock.SteimFrame[] getSteimFrames()
           
 int getSteimVersion()
          Return the version of Steim compression used
 int numNonEmptyFrames()
           
protected  void setXsubN(int word)
          Set the reverse integration constant X(N) explicitly to the provided word value.
 void trimEmptyFrames()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SteimFrameBlock

public SteimFrameBlock(int numFrames,
                       int steimVersion)
Create a new block of Steim frames for a particular version of Steim copression. Instantiate object with the number of 64-byte frames that this block will contain (should connect to data record header such that a proper power of 2 boundary is formed for the data record) AND the version of Steim compression used (1 and 2 currently) the number of frames remains static...frames that are not filled with data are simply full of nulls.

Parameters:
numFrames - the number of frames in this Steim record
steimVersion - which version of Steim compression is being used (1,2,3).
Method Detail

getNumSamples

public int getNumSamples()
Return the number of data samples represented by this frame block

Returns:
integer value indicating number of samples

getSteimVersion

public int getSteimVersion()
Return the version of Steim compression used

Returns:
integer value representing the Steim version (1,2,3)

getSteimFrames

public edu.iris.dmc.seedcodec.SteimFrameBlock.SteimFrame[] getSteimFrames()

numNonEmptyFrames

public int numNonEmptyFrames()

trimEmptyFrames

public void trimEmptyFrames()

getEncodedData

public byte[] getEncodedData()
                      throws java.io.IOException
Return the compressed byte representation of the data for inclusion in a data record.

Returns:
byte array containing the encoded, compressed data
Throws:
java.io.IOException - from called method(s)

getNumFrames

public int getNumFrames()
Return the number of frames in this frame block

Returns:
integer value indicating number of frames

addEncodedWord

protected boolean addEncodedWord(int word,
                                 int samples,
                                 int nibble)
Add a single 32-bit word to current frame.

Parameters:
samples - the number of sample differences in the word
nibble - a value of 0 to 3 that reflects the W0 encoding for this word
Returns:
boolean indicating true if the block is full (ie: the calling app should not add any more to this object)

setXsubN

protected void setXsubN(int word)
Set the reverse integration constant X(N) explicitly to the provided word value. This method is typically used to reset X(N) should the compressor fill the frame block before all samples have been read.

Parameters:
word - integer value to be placed in X(N)