Package edu.iris.dmc.seedcodec
Class Codec
java.lang.Object
edu.iris.dmc.seedcodec.Codec
- All Implemented Interfaces:
B1000Types
Codec.java
Created: Thu Nov 21 13:01:20 2002
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondecompress
(int type, byte[] b, int numSamples, boolean swapBytes) Decompresses the data into the best java primitive type for the given compression and returns it.byte[]
encodeAsBytes
(double[] data) encodes the float data as a byte array.byte[]
encodeAsBytes
(float[] data) encodes the float data as a byte array.byte[]
encodeAsBytes
(int[] data) encodes the integer data as a byte array.byte[]
encodeAsBytes
(short[] data) encodes the short data as a byte array.int
getDecompressedType
(int type) returns an integer that represent the java primitive that the data will decompresses to.boolean
isDecompressable
(int type) Is the encoding type decompressable.
-
Constructor Details
-
Codec
public Codec()
-
-
Method Details
-
isDecompressable
public boolean isDecompressable(int type) Is the encoding type decompressable. If this class is overridden to add new types, this method should be overridden to account for the new type.- Parameters:
type
- Encoding type, usually from a Blockette1000- Returns:
- true if decompressable, false otherwise
-
decompress
public DecompressedData decompress(int type, byte[] b, int numSamples, boolean swapBytes) throws CodecException, UnsupportedCompressionType Decompresses the data into the best java primitive type for the given compression and returns it. -
getDecompressedType
returns an integer that represent the java primitive that the data will decompresses to. This is to allow for SEED types 4 and 5, float and double, which cannot be represented as int without a loss of precision.- Throws:
UnsupportedCompressionType
-
encodeAsBytes
public byte[] encodeAsBytes(short[] data) encodes the short data as a byte array. This is the inverse operation to decompress() with seed type 1 - 16 bit integers. -
encodeAsBytes
public byte[] encodeAsBytes(int[] data) encodes the integer data as a byte array. This is the inverse operation to decompress() with seed type 3 - 32 bit integers. -
encodeAsBytes
public byte[] encodeAsBytes(float[] data) encodes the float data as a byte array. This is the inverse operation to decompress() with seed type 4 - 32 bit floats. -
encodeAsBytes
public byte[] encodeAsBytes(double[] data) encodes the float data as a byte array. This is the inverse operation to decompress() with seed type 5 - 64 bit floats.
-