Class RegularDataEncoder
- java.lang.Object
-
- org.apache.iotdb.tsfile.encoding.encoder.Encoder
-
- org.apache.iotdb.tsfile.encoding.encoder.RegularDataEncoder
-
- Direct Known Subclasses:
RegularDataEncoder.IntRegularEncoder,RegularDataEncoder.LongRegularEncoder
public abstract class RegularDataEncoder extends Encoder
RegularDataEncoder is an encoder for compressing data in type of integer and long. We adapt a hypothesis that the difference between each data point is the same, which it means the data is regular.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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classRegularDataEncoder.IntRegularEncoderstatic classRegularDataEncoder.LongRegularEncoder
-
Field Summary
Fields Modifier and Type Field Description protected static intBLOCK_DEFAULT_SIZEprotected intblockSizeprotected intdataTotalprotected booleanisMissingPointprotected java.io.ByteArrayOutputStreamoutprotected intwriteIndex-
Fields inherited from class org.apache.iotdb.tsfile.encoding.encoder.Encoder
MAX_POINT_NUMBER, MAX_STRING_LENGTH
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedRegularDataEncoder(int size)constructor of RegularDataEncoder.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract voidcheckMissingPoint(java.io.ByteArrayOutputStream out)voidflush(java.io.ByteArrayOutputStream out)calling this method to flush all values which haven't encoded to result byte array.protected voidflushBlockBuffer(java.io.ByteArrayOutputStream out)protected abstract voidreset()protected abstract voidwriteBitmap(java.io.ByteArrayOutputStream out)protected abstract voidwriteHeader()protected voidwriteHeaderToBytes()
-
-
-
Field Detail
-
BLOCK_DEFAULT_SIZE
protected static final int BLOCK_DEFAULT_SIZE
- See Also:
- Constant Field Values
-
out
protected java.io.ByteArrayOutputStream out
-
blockSize
protected int blockSize
-
isMissingPoint
protected boolean isMissingPoint
-
writeIndex
protected int writeIndex
-
dataTotal
protected int dataTotal
-
-
Method Detail
-
writeHeader
protected abstract void writeHeader() throws java.io.IOException- Throws:
java.io.IOException
-
reset
protected abstract void reset()
-
checkMissingPoint
protected abstract void checkMissingPoint(java.io.ByteArrayOutputStream out) throws java.io.IOException- Throws:
java.io.IOException
-
writeBitmap
protected abstract void writeBitmap(java.io.ByteArrayOutputStream out) throws java.io.IOException- Throws:
java.io.IOException
-
writeHeaderToBytes
protected void writeHeaderToBytes() throws java.io.IOException- Throws:
java.io.IOException
-
flushBlockBuffer
protected void flushBlockBuffer(java.io.ByteArrayOutputStream out) throws java.io.IOException- Throws:
java.io.IOException
-
-