public abstract class RleDecoder extends Decoder
<length> <bitwidth> <encoded-data>. For more information about rle format, see RleEncoder| Modifier and Type | Class and Description |
|---|---|
protected static class |
RleDecoder.Mode |
| Modifier and Type | Field and Description |
|---|---|
protected int |
bitPackingNum
number of bit-packing group in which is saved in header.
|
protected int |
bitWidth
bit width for bit-packing and rle to decode.
|
protected ByteBuffer |
byteCache
buffer to save data format like [
<bitwidth> <encoded-data>] for decoder. |
protected TSFileConfig |
config |
protected int |
currentCount
number of data left for reading in current buffer.
|
protected boolean |
isLengthAndBitWidthReaded
a flag to indicate whether current pattern is end.
|
protected int |
length
how many bytes for all encoded data like [
<bitwidth> <encoded-data>] in inputstream. |
protected RleDecoder.Mode |
mode
mode to indicate current encoding type 0 - RLE 1 - BIT_PACKED.
|
| Modifier | Constructor and Description |
|---|---|
protected |
RleDecoder()
a constructor, init with endianType, default encoding is
TSEncoding.RLE. |
| Modifier and Type | Method and Description |
|---|---|
protected void |
callReadBitPackingBuffer(int header) |
int |
getHeader()
get header for both rle and bit-packing current encode mode which is saved in first bit of
header.
|
boolean |
hasNext(ByteBuffer buffer)
Check whether there is number left for reading.
|
protected boolean |
hasNextPackage()
Check whether there is another pattern left for reading.
|
protected abstract void |
initPacker() |
BigDecimal |
readBigDecimal(ByteBuffer buffer) |
Binary |
readBinary(ByteBuffer buffer) |
protected abstract void |
readBitPackingBuffer(int bitPackedGroupCount,
int lastBitPackedNum)
Read bit-packing package and save them in buffer.
|
boolean |
readBoolean(ByteBuffer buffer) |
double |
readDouble(ByteBuffer buffer) |
float |
readFloat(ByteBuffer buffer) |
int |
readInt(ByteBuffer buffer) |
protected void |
readLengthAndBitWidth(ByteBuffer buffer)
read length and bit width of current package before we decode number.
|
long |
readLong(ByteBuffer buffer) |
protected void |
readNext()
get all encoded data according to mode.
|
protected abstract void |
readNumberInRle()
Read rle package and save them in buffer.
|
short |
readShort(ByteBuffer buffer) |
void |
reset() |
getDecoderByType, getType, setTypeprotected TSFileConfig config
protected RleDecoder.Mode mode
protected int bitWidth
protected int currentCount
protected int length
<bitwidth> <encoded-data>] in inputstream.protected boolean isLengthAndBitWidthReaded
protected ByteBuffer byteCache
<bitwidth> <encoded-data>] for decoder.protected int bitPackingNum
protected RleDecoder()
TSEncoding.RLE.public int getHeader()
throws IOException
IOException - cannot get headerprotected void readNext()
throws IOException
IOException - cannot read next valueprotected void callReadBitPackingBuffer(int header)
throws IOException
IOExceptionprotected void readLengthAndBitWidth(ByteBuffer buffer)
buffer - ByteBufferpublic boolean hasNext(ByteBuffer buffer) throws IOException
hasNext in class Decoderbuffer - decoded data saved in ByteBufferIOException - cannot check next valueprotected boolean hasNextPackage()
protected abstract void initPacker()
protected abstract void readNumberInRle()
throws IOException
IOException - cannot read numberprotected abstract void readBitPackingBuffer(int bitPackedGroupCount,
int lastBitPackedNum)
throws IOException
bitPackedGroupCount - number of group numberlastBitPackedNum - number of useful value in last groupIOException - cannot read bit packpublic boolean readBoolean(ByteBuffer buffer)
readBoolean in class Decoderpublic short readShort(ByteBuffer buffer)
public int readInt(ByteBuffer buffer)
public long readLong(ByteBuffer buffer)
public float readFloat(ByteBuffer buffer)
public double readDouble(ByteBuffer buffer)
readDouble in class Decoderpublic Binary readBinary(ByteBuffer buffer)
readBinary in class Decoderpublic BigDecimal readBigDecimal(ByteBuffer buffer)
readBigDecimal in class DecoderCopyright © 2022 The Apache Software Foundation. All rights reserved.