public abstract class RegularDataEncoder extends Encoder
To encode the regular data, we first create an array as a block to store the data loaded into the encoder. While it reach the default block size, start calculating the delta between each data point in this block in order to checkout whether there are missing points exist in the data. If there is, create a bitmap for this block to denote the position of missing points. Next, store the data info (the data size, the minimum delta value and the first data point of this block) and the bitmap with its info into the result byte array output stream.
| Modifier and Type | Class and Description |
|---|---|
static class |
RegularDataEncoder.IntRegularEncoder |
static class |
RegularDataEncoder.LongRegularEncoder |
| Modifier and Type | Field and Description |
|---|---|
protected static int |
BLOCK_DEFAULT_SIZE |
protected int |
blockSize |
protected int |
dataTotal |
protected boolean |
isMissingPoint |
protected ByteArrayOutputStream |
out |
protected int |
writeIndex |
MAX_POINT_NUMBER, MAX_STRING_LENGTH| Constructor and Description |
|---|
RegularDataEncoder(int size)
constructor of RegularDataEncoder.
|
| Modifier and Type | Method and Description |
|---|---|
protected abstract void |
checkMissingPoint(ByteArrayOutputStream out) |
void |
flush(ByteArrayOutputStream out)
calling this method to flush all values which haven't encoded to result byte array.
|
protected void |
flushBlockBuffer(ByteArrayOutputStream out) |
protected abstract void |
reset() |
protected abstract void |
writeBitmap(ByteArrayOutputStream out) |
protected abstract void |
writeHeader() |
protected void |
writeHeaderToBytes() |
protected static final int BLOCK_DEFAULT_SIZE
protected ByteArrayOutputStream out
protected int blockSize
protected boolean isMissingPoint
protected int writeIndex
protected int dataTotal
public RegularDataEncoder(int size)
size - - the number how many numbers to be packed into a block.protected abstract void writeHeader()
throws IOException
IOExceptionprotected abstract void reset()
protected abstract void checkMissingPoint(ByteArrayOutputStream out) throws IOException
IOExceptionprotected abstract void writeBitmap(ByteArrayOutputStream out) throws IOException
IOExceptionprotected void writeHeaderToBytes()
throws IOException
IOExceptionprotected void flushBlockBuffer(ByteArrayOutputStream out) throws IOException
IOExceptionpublic void flush(ByteArrayOutputStream out)
Copyright © 2022 The Apache Software Foundation. All rights reserved.