There are a number of standard Codecs (UDELTA5, UNSIGNED5, BYTE1, CHAR3) that are used in the implementation of many
bands; but there are a variety of other ones, and indeed the specification assumes that other combinations of values can result in more specific and
efficient formats. There are also a sequence of canonical encodings defined by the Pack200 specification, which allow a Codec to be referred to by canonical
number. CodecEncoding#getCodec(int, InputStream, Codec))
| Modifier and Type | Field and Description |
|---|---|
| public static final BHSDCodec | BCI5
BCI5 = (5,4): Used for storing branching information in bytecode. |
| public static final BHSDCodec | BRANCH5
BRANCH5 = (5,4,2): Used for storing branching information in bytecode. |
| public static final BHSDCodec | BYTE1
BYTE1 = (1,256): Used for storing plain bytes. |
| public static final BHSDCodec | CHAR3
CHAR3 = (3,128): Used for storing text (UTF-8) strings. |
| public static final BHSDCodec | DELTA5
DELTA5 = (5,64,1,1): Used for the majority of numerical codings where there is a correlated sequence of signed values. |
| public int | |
| public static final BHSDCodec | MDELTA5
MDELTA5 = (5,64,2,1): Used for the majority of numerical codings where there is a correlated sequence of signed values, but where most of them are expected to be non-negative. |
| public static final BHSDCodec | SIGNED5
SIGNED5 = (5,64,1): Used for small signed values. |
| public static final BHSDCodec | UDELTA5
UDELTA5 = (5,64,0,1): Used for the majority of numerical codings where there is a correlated sequence of unsigned values. |
| public static final BHSDCodec | UNSIGNED5
UNSIGNED5 = (5,64): Used for small unsigned values. |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv int | |
| public abstract int | Returns: the value as a longthe input stream to read from in)Decodes a sequence of bytes from the given input stream, returning the value as a long. |
| public abstract int | Returns: the value as a longthe input stream to read from in, long the previous value read, which must be supplied if the codec is a delta encoding last)Decodes a sequence of bytes from the given input stream, returning the value as a long. |
| public int[] | Returns: an array ofint values corresponding to values decodedthe number of values to decode n, final InputStream the input stream to read from in)Decodes a sequence of |
| public int[] | Returns: an array ofint values corresponding to values decoded, with firstValue as the first value in the array.the number of values to decode n, final InputStream the input stream to read from in, final int the first value in the band if it has already been read firstValue)Decodes a sequence of |
| public abstract byte[] | Returns: the encoded bytesthe value to encode value)Encodes a single value into a sequence of bytes. |
| public abstract byte[] | Returns: the encoded bytesthe value to encode value, int the previous value encoded (for delta encodings) last)Encodes a single value into a sequence of bytes. |
| public byte[] | Returns: byte[] encoded bytesthe values to encode ints)Encodes a sequence of integers into a byte array |
| BCI5 | back to summary |
|---|---|
| public static final BHSDCodec BCI5 BCI5 = (5,4): Used for storing branching information in bytecode. | |
| BRANCH5 | back to summary |
|---|---|
| public static final BHSDCodec BRANCH5 BRANCH5 = (5,4,2): Used for storing branching information in bytecode. | |
| BYTE1 | back to summary |
|---|---|
| public static final BHSDCodec BYTE1 BYTE1 = (1,256): Used for storing plain bytes. | |
| CHAR3 | back to summary |
|---|---|
| public static final BHSDCodec CHAR3 CHAR3 = (3,128): Used for storing text (UTF-8) strings. This isn't quite the same as UTF-8, but has similar properties; ASCII characters < 127 are stored in a single byte. | |
| DELTA5 | back to summary |
|---|---|
| public static final BHSDCodec DELTA5 DELTA5 = (5,64,1,1): Used for the majority of numerical codings where there is a correlated sequence of signed values. | |
| lastBandLength | back to summary |
|---|---|
| public int lastBandLength | |
| MDELTA5 | back to summary |
|---|---|
| public static final BHSDCodec MDELTA5 MDELTA5 = (5,64,2,1): Used for the majority of numerical codings where there is a correlated sequence of signed values, but where most of them are expected to be non-negative. | |
| SIGNED5 | back to summary |
|---|---|
| public static final BHSDCodec SIGNED5 SIGNED5 = (5,64,1): Used for small signed values. | |
| UDELTA5 | back to summary |
|---|---|
| public static final BHSDCodec UDELTA5 UDELTA5 = (5,64,0,1): Used for the majority of numerical codings where there is a correlated sequence of unsigned values. | |
| UNSIGNED5 | back to summary |
|---|---|
| public static final BHSDCodec UNSIGNED5 UNSIGNED5 = (5,64): Used for small unsigned values. | |
| Codec | back to summary |
|---|---|
| public Codec() | |
| check | back to summary |
|---|---|
| pack-priv int check(final int n, final InputStream in) throws Pack200Exception | |
| decode | back to summary |
|---|---|
| public abstract int decode(InputStream in) throws IOException, Pack200Exception Decodes a sequence of bytes from the given input stream, returning the value as a long. Note that this method can only be applied for non-delta encodings.
| |
| decode | back to summary |
|---|---|
| public abstract int decode(InputStream in, long last) throws IOException, Pack200Exception Decodes a sequence of bytes from the given input stream, returning the value as a long. If this encoding is a delta encoding (d=1) then the previous value must be passed in as a parameter. If it is a non-delta encoding, then it does not matter what value is passed in, so it makes sense for the value to be passed in by default using code similar to:
long last = 0;
while (condition) {
last = codec.decode(in, last);
// do something with last
}
| |
| decodeInts | back to summary |
|---|---|
| public int[] decodeInts(final int n, final InputStream in) throws IOException, Pack200Exception Decodes a sequence of
| |
| decodeInts | back to summary |
|---|---|
| public int[] decodeInts(final int n, final InputStream in, final int firstValue) throws IOException, Pack200Exception Decodes a sequence of
| |
| encode | back to summary |
|---|---|
| public abstract byte[] encode(int value) throws Pack200Exception Encodes a single value into a sequence of bytes. Note that this method can only be used for non-delta encodings.
| |
| encode | back to summary |
|---|---|
| public abstract byte[] encode(int value, int last) throws Pack200Exception Encodes a single value into a sequence of bytes.
| |
| encode | back to summary |
|---|---|
| public byte[] encode(final int[] ints) throws Pack200Exception Encodes a sequence of integers into a byte array
| |