public abstract class DeltaBinaryEncoder extends Encoder
DeltaBinaryEncoder calculates difference between two adjacent points and record the minimum of
those difference values firstly. Then it saves two_diff value that difference minus minimum of
them, to make sure all two_diff values are positive. Then it statistics the longest bit length
m it takes for each two_diff value, which means the bit length that maximum two_diff
value takes. Only the low m bits are saved into result byte array for all two_diff values.
| Modifier and Type | Class and Description |
|---|---|
static class |
DeltaBinaryEncoder.IntDeltaEncoder |
static class |
DeltaBinaryEncoder.LongDeltaEncoder |
| Modifier and Type | Field and Description |
|---|---|
protected static int |
BLOCK_DEFAULT_SIZE |
protected int |
blockSize |
protected byte[] |
encodingBlockBuffer |
protected ByteArrayOutputStream |
out |
protected int |
writeIndex |
protected int |
writeWidth |
MAX_POINT_NUMBER, MAX_STRING_LENGTH| Constructor and Description |
|---|
DeltaBinaryEncoder(int size)
constructor of DeltaBinaryEncoder.
|
| Modifier and Type | Method and Description |
|---|---|
protected abstract void |
calcTwoDiff(int i) |
protected abstract int |
calculateBitWidthsForDeltaBlockBuffer() |
void |
flush(ByteArrayOutputStream out)
calling this method to flush all values which haven't encoded to result byte array.
|
protected abstract void |
reset() |
protected abstract void |
writeHeader() |
protected abstract void |
writeValueToBytes(int i) |
protected static final int BLOCK_DEFAULT_SIZE
protected ByteArrayOutputStream out
protected int blockSize
protected byte[] encodingBlockBuffer
protected int writeIndex
protected int writeWidth
public DeltaBinaryEncoder(int size)
size - - the number how many numbers to be packed into a block.protected abstract void writeHeader()
throws IOException
IOExceptionprotected abstract void writeValueToBytes(int i)
protected abstract void calcTwoDiff(int i)
protected abstract void reset()
protected abstract int calculateBitWidthsForDeltaBlockBuffer()
public void flush(ByteArrayOutputStream out)
Copyright © 2022 The Apache Software Foundation. All rights reserved.