- java.lang.Object
-
- kala.compress.harmony.pack200.CodecEncoding
-
public class CodecEncoding extends java.lang.ObjectCodecEncoding is used to get the right Codec for a given meta-encoding.
-
-
Field Summary
Fields Modifier and Type Field Description private static BHSDCodec[]canonicalCodecThe canonical encodings are defined to allow a single byte to represent one of the standard encodings.private static java.util.Map<BHSDCodec,java.lang.Integer>canonicalCodecsToSpecifiersprivate static int[]EMPTY_INT_ARRAY
-
Constructor Summary
Constructors Constructor Description CodecEncoding()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static BHSDCodecgetCanonicalCodec(int i)static CodecgetCodec(int value, java.io.InputStream in, Codec defaultCodec)Gets the codec specified by the given value byte and optional byte header.static int[]getSpecifier(Codec codec, Codec defaultForBand)static intgetSpecifierForDefaultCodec(BHSDCodec defaultCodec)
-
-
-
Field Detail
-
EMPTY_INT_ARRAY
private static final int[] EMPTY_INT_ARRAY
-
canonicalCodec
private static final BHSDCodec[] canonicalCodec
The canonical encodings are defined to allow a single byte to represent one of the standard encodings. The following values are defined in the Pack200 specification, and this array cannot be changed.
-
canonicalCodecsToSpecifiers
private static java.util.Map<BHSDCodec,java.lang.Integer> canonicalCodecsToSpecifiers
-
-
Method Detail
-
getCanonicalCodec
public static BHSDCodec getCanonicalCodec(int i)
-
getCodec
public static Codec getCodec(int value, java.io.InputStream in, Codec defaultCodec) throws java.io.IOException, Pack200Exception
Gets the codec specified by the given value byte and optional byte header. If the value is >= 116, then bytes may be consumed from the secondary input stream, which is taken to be the contents of the band_headers byte array. Since the values from this are consumed and not repeated, the input stream should be reused for subsequent encodings. This does not therefore close the input stream.- Parameters:
value- the canonical encoding valuein- the input stream to read additional byte headers fromdefaultCodec- TODO- Returns:
- the corresponding codec, or
nullif the default should be used - Throws:
java.io.IOException- if there is a problem reading from the input stream (which in reality, is never, since the band_headers are likely stored in a byte array and accessed via a ByteArrayInputStream. However, an EOFException could occur if things go wrong)Pack200Exception- TODO
-
getSpecifierForDefaultCodec
public static int getSpecifierForDefaultCodec(BHSDCodec defaultCodec)
-
-