Class Codec

java.lang.Object
edu.iris.dmc.seedcodec.Codec
All Implemented Interfaces:
B1000Types

public class Codec extends Object implements B1000Types
Codec.java Created: Thu Nov 21 13:01:20 2002
  • 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.
      Throws:
      CodecException
      UnsupportedCompressionType
    • getDecompressedType

      public int getDecompressedType(int type) throws UnsupportedCompressionType
      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.