edu.iris.Fissures.codec
Class Steim1

java.lang.Object
  extended by edu.iris.Fissures.codec.Steim1

Deprecated. Please begin use of the edu.iris.dmc.seedcodec package in place of this

public class Steim1
extends java.lang.Object

Class for decoding or encoding Steim1-compressed data blocks to or from an array of integer values.

Steim compression scheme Copyrighted by Dr. Joseph Steim.

Reference material found in:
Appendix B of SEED Reference Manual, 2nd Ed., pp. 119-125 Federation of Digital Seismic Networks, et al. February, 1993
Coding concepts gleaned from code written by:
Guy Stewart, IRIS, 1991
Tom McSweeney, IRIS, 2000

Version:
10/22/2002
Author:
Philip Crotwell (U South Carolina), Robert Casey (IRIS DMC)

Constructor Summary
Steim1()
          Deprecated.  
 
Method Summary
static int[] decode(byte[] b, int numSamples, boolean swapBytes)
          Deprecated. Abbreviated, zero-bias version of decode().
static int[] decode(byte[] b, int numSamples, boolean swapBytes, int bias)
          Deprecated. Decode the indicated number of samples from the provided byte array and return an integer array of the decompressed values.
static SteimFrameBlock encode(int[] samples, int frames)
          Deprecated. Abbreviated zero-bias version of encode().
static SteimFrameBlock encode(int[] samples, int frames, int bias)
          Deprecated. Encode the array of integer values into a Steim 1 * compressed byte frame block.
protected static int[] extractSamples(byte[] bytes, int offset, boolean swapBytes)
          Deprecated. Extracts differences from the next 64 byte frame of the given compressed byte array (starting at offset) and returns those differences in an int array.
static void main(java.lang.String[] args)
          Deprecated. Static method for testing the decode() method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Steim1

public Steim1()
Deprecated. 
Method Detail

decode

public static int[] decode(byte[] b,
                           int numSamples,
                           boolean swapBytes,
                           int bias)
                    throws SteimException
Deprecated. 
Decode the indicated number of samples from the provided byte array and return an integer array of the decompressed values. Being differencing compression, there may be an offset carried over from a previous data record. This offset value can be placed in bias, otherwise leave the value as 0.

Parameters:
b - input byte array to be decoded
numSamples - the number of samples that can be decoded from array b
swapBytes - if true, swap reverse the endian-ness of the elements of byte array b.
bias - the first difference value will be computed from this value. If set to 0, the method will attempt to use the X(0) constant instead.
Returns:
int array of length numSamples.
Throws:
SteimException - - encoded data length is not multiple of 64 bytes.

decode

public static int[] decode(byte[] b,
                           int numSamples,
                           boolean swapBytes)
                    throws SteimException
Deprecated. 
Abbreviated, zero-bias version of decode().

Throws:
SteimException
See Also:
decode(byte[],int,boolean,int)

encode

public static SteimFrameBlock encode(int[] samples,
                                     int frames,
                                     int bias)
                              throws SteimException
Deprecated. 
Encode the array of integer values into a Steim 1 * compressed byte frame block. This algorithm will not create a byte block any greater * than 63 64-byte frames. frames represents the number of frames to be written. This number should be determined from the desired logical record length minus the data offset from the record header (modulo 64) If samples is exhausted before all frames are filled, the remaining frames will be nulls. bias is a value carried over from a previous data record, representing X(-1)...set to 0 otherwise

Parameters:
samples - the data points represented as signed integers
frames - the number of Steim frames to use in the encoding
bias - offset for use as a constant for the first difference, otherwise set to 0
Returns:
SteimFrameBlock containing encoded byte array
Throws:
SteimException - samples array is zero size
SteimException - number of frames is not a positive value
SteimException - cannot encode more than 63 frames

encode

public static SteimFrameBlock encode(int[] samples,
                                     int frames)
                              throws SteimException
Deprecated. 
Abbreviated zero-bias version of encode().

Throws:
SteimException
See Also:
encode(int[],int,int)

extractSamples

protected static int[] extractSamples(byte[] bytes,
                                      int offset,
                                      boolean swapBytes)
Deprecated. 
Extracts differences from the next 64 byte frame of the given compressed byte array (starting at offset) and returns those differences in an int array. An offset of 0 means that we are at the first frame, so include the header bytes in the returned int array...else, do not include the header bytes in the returned array.

Parameters:
bytes - byte array of compressed data differences
offset - index to begin reading compressed bytes for decoding
swapBytes - reverse the endian-ness of the compressed bytes being read
Returns:
integer array of difference (and constant) values

main

public static void main(java.lang.String[] args)
                 throws SteimException
Deprecated. 
Static method for testing the decode() method.

Parameters:
args - not used
Throws:
SteimException - from called method(s)