Class BitmapEncoder
- java.lang.Object
-
- org.apache.iotdb.tsfile.encoding.encoder.Encoder
-
- org.apache.iotdb.tsfile.encoding.encoder.BitmapEncoder
-
public class BitmapEncoder extends Encoder
Encodes values using bitmap, according to the following grammar:bitmap-encoding: <length> <num> <encoded-data> length := length of the <encoded-data> in bytes stored as unsigned var int num := number for all encoded data in <encoded-data> stored as unsigned var int encoded-data := <run>* run := <value> <bit-index> value := value in the data after deduplication. Use varint-encode and store as unsigned var int bit-index := a list of 01 sequence to record the position of the value aboveDecode switch or enum values using bitmap, bitmap-encode.
<length> <num> <encoded data>
-
-
Field Summary
-
Fields inherited from class org.apache.iotdb.tsfile.encoding.encoder.Encoder
MAX_POINT_NUMBER, MAX_STRING_LENGTH
-
-
Constructor Summary
Constructors Constructor Description BitmapEncoder()BitmapEncoder constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidencode(int value, java.io.ByteArrayOutputStream out)Each time encoder receives a value, encoder doesn't write it to OutputStream immediately.voidflush(java.io.ByteArrayOutputStream out)When all data received, encoder now encodes values in list and write them to OutputStream.longgetMaxByteSize()The maximal possible memory size occupied by current Encoder.intgetOneItemMaxSize()When encoder accepts a new incoming data point, the maximal possible size in byte it takes to store in memory.
-
-
-
Method Detail
-
encode
public void encode(int value, java.io.ByteArrayOutputStream out)Each time encoder receives a value, encoder doesn't write it to OutputStream immediately. Encoder stores current value in a list. When all value is received, flush() method will be invoked. Encoder encodes all values and writes them to OutputStream.- Overrides:
encodein classEncoder- Parameters:
value- value to encodeout- OutputStream to write encoded stream- Throws:
java.io.IOException- cannot encode value- See Also:
Encoder.encode(int, java.io.ByteArrayOutputStream)
-
flush
public void flush(java.io.ByteArrayOutputStream out) throws java.io.IOExceptionWhen all data received, encoder now encodes values in list and write them to OutputStream.- Specified by:
flushin classEncoder- Parameters:
out- OutputStream to write encoded stream- Throws:
java.io.IOException- cannot flush to OutputStream- See Also:
Encoder.flush(java.io.ByteArrayOutputStream)
-
getOneItemMaxSize
public int getOneItemMaxSize()
Description copied from class:EncoderWhen encoder accepts a new incoming data point, the maximal possible size in byte it takes to store in memory.- Overrides:
getOneItemMaxSizein classEncoder- Returns:
- the maximal possible size of one data item encoded by this encoder
-
getMaxByteSize
public long getMaxByteSize()
Description copied from class:EncoderThe maximal possible memory size occupied by current Encoder. This statistic value doesn't involve OutputStream.- Overrides:
getMaxByteSizein classEncoder- Returns:
- the maximal size of possible memory occupied by current encoder
-
-