public class FourFlagsIntEncoder extends ChunksIntEncoder
ChunksIntEncoder which encodes values in chunks of 4. Every group
starts with a single byte (called indicator) which represents 4 - 2 bit
flags, where the values:
VInt8IntEncoder, and the
encoded bytes follow the indicator.value-4, which saves some more bits.
DGapIntEncoder)
encodeQueue, encodeQueueSize, encoder, indicator, ordinalout| Constructor and Description |
|---|
FourFlagsIntEncoder() |
| Modifier and Type | Method and Description |
|---|---|
IntDecoder |
createMatchingDecoder()
Returns an
IntDecoder which matches this encoder. |
void |
encode(int data)
Small values (<=3) are stored in the
indicator while larger
values are saved for later encoding in the ChunksIntEncoder.encodeQueue. |
String |
toString() |
close, encodeChunk, reInitpublic void encode(int data)
throws IOException
indicator while larger
values are saved for later encoding in the ChunksIntEncoder.encodeQueue. Since
Vint8 will only encode values larger or equal to 4, the values saves for
encoded are transformed to (value - 4).ChunksIntEncoder.encodeChunk()
takes control.encode in class IntEncoderIOExceptionpublic IntDecoder createMatchingDecoder()
IntEncoderIntDecoder which matches this encoder. Every encoder
must return an IntDecoder and null is not a valid
value. If an encoder is just a filter, it should at least return its
wrapped encoder's matching decoder.
NOTE: this method should create a new instance of the matching decoder and leave the instance sharing to the caller. Returning the same instance over and over is risky because encoders and decoders are not thread safe.
createMatchingDecoder in class IntEncoderCopyright © 2000-2015 Apache Software Foundation. All Rights Reserved.