| Constructor and Description |
|---|
RunCodec(int k,
Codec aCodec,
Codec bCodec) |
| Modifier and Type | Method and Description |
|---|---|
int |
decode(InputStream in)
Decode a sequence of bytes from the given input stream, returning the value as a long.
|
int |
decode(InputStream in,
long last)
Decode a sequence of bytes from the given input stream, returning the value as a long.
|
int[] |
decodeInts(int n,
InputStream in)
Decodes a sequence of
n values from in. |
byte[] |
encode(int value)
Encode a single value into a sequence of bytes.
|
byte[] |
encode(int value,
int last)
Encode a single value into a sequence of bytes.
|
Codec |
getACodec() |
Codec |
getBCodec() |
int |
getK() |
String |
toString() |
decodeInts, encodepublic RunCodec(int k, Codec aCodec, Codec bCodec) throws Pack200Exception
Pack200Exceptionpublic int decode(InputStream in) throws IOException, Pack200Exception
Codecdecode in class Codecin - the input stream to read fromIOException - if there is a problem reading from the underlying input streamPack200Exception - if the encoding is a delta encodingpublic int decode(InputStream in, long last) throws IOException, Pack200Exception
Codec
long last = 0;
while (condition) {
last = codec.decode(in, last);
// do something with last
}
decode in class Codecin - the input stream to read fromlast - the previous value read, which must be supplied if the codec is a delta encodingIOException - if there is a problem reading from the underlying input streamPack200Exception - if there is a problem decoding the value or that the value is invalidpublic int[] decodeInts(int n, InputStream in) throws IOException, Pack200Exception
Codecn values from in. This should probably be used in most cases,
since some codecs (such as PopulationCodec) only work when the number of values to be read is known.decodeInts in class Codecn - the number of values to decodein - the input stream to read fromint values corresponding to values decodedIOException - if there is a problem reading from the underlying input streamPack200Exception - if there is a problem decoding the value or that the value is invalidpublic byte[] encode(int value, int last) throws Pack200Exception
Codecencode in class Codecvalue - the value to encodelast - the previous value encoded (for delta encodings)Pack200Exception - TODOpublic byte[] encode(int value) throws Pack200Exception
Codecencode in class Codecvalue - the value to encodePack200Exception - TODOpublic int getK()
Copyright © 2002–2020 The Apache Software Foundation. All rights reserved.