edu.iris.Fissures.seed.codec
Class Steim2
java.lang.Object
|
+--edu.iris.Fissures.seed.codec.Steim2
- public class Steim2
- extends java.lang.Object
Class for decoding or encoding Steim2-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/23/2002
- Author:
- Philip Crotwell (U South Carolina), Robert Casey (IRIS DMC)
Method Summary |
static int[] |
decode(byte[] b,
int numSamples,
boolean swapBytes)
Abbreviated, zero-bias version of decode(). |
static int[] |
decode(byte[] b,
int numSamples,
boolean swapBytes,
int bias)
Decode the indicated number of samples from the provided byte array and
return an integer array of the decompressed values. |
static byte[] |
encode(int[] samples)
|
protected static int[] |
extractSamples(byte[] bytes,
int offset,
boolean swapBytes)
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)
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 |
Steim2
public Steim2()
decode
public static int[] decode(byte[] b,
int numSamples,
boolean swapBytes,
int bias)
throws SeedException
- 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 decodednumSamples
- the number of samples that can be decoded from array
bswapBytes
- 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:
SeedFormatException
- - encoded data length is not multiple of 64
bytes.
decode
public static int[] decode(byte[] b,
int numSamples,
boolean swapBytes)
throws SeedException
- Abbreviated, zero-bias version of decode().
- See Also:
decode(byte[],int,boolean,int)
encode
public static byte[] encode(int[] samples)
extractSamples
protected static int[] extractSamples(byte[] bytes,
int offset,
boolean swapBytes)
- 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 differencesoffset
- index to begin reading compressed bytes for decodingswapBytes
- 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 SeedException
- Static method for testing the decode() method.
- Parameters:
args
- not used- Throws:
SeedException
- from called method(s)