Class ChunkHeader
- java.lang.Object
-
- org.apache.iotdb.tsfile.file.header.ChunkHeader
-
public class ChunkHeader extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description ChunkHeader(byte chunkType, java.lang.String measurementID, int dataSize, int headerSize, TSDataType dataType, CompressionType compressionType, TSEncoding encoding)ChunkHeader(byte chunkType, java.lang.String measurementID, int dataSize, TSDataType dataType, CompressionType compressionType, TSEncoding encoding)ChunkHeader(java.lang.String measurementID, int dataSize, TSDataType dataType, CompressionType compressionType, TSEncoding encoding, int numOfPages)ChunkHeader(java.lang.String measurementID, int dataSize, TSDataType dataType, CompressionType compressionType, TSEncoding encoding, int numOfPages, int mask)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Pair<CompressionType,TSEncoding>deserializeCompressionTypeAndEncoding(java.io.InputStream inputStream)Used byTsFileSequenceReader.readTimeseriesCompressionTypeAndEncoding(TimeseriesMetadata)to only decode data size,CompressionTypeandTSEncoding.static ChunkHeaderdeserializeFrom(java.io.InputStream inputStream, byte chunkType)deserialize from inputStream, the marker has already been read.static ChunkHeaderdeserializeFrom(TsFileInput input, long offset, int chunkHeaderSize)deserialize from TsFileInput, the marker has not been read.bytegetChunkType()CompressionTypegetCompressionType()intgetDataSize()TSDataTypegetDataType()TSEncodinggetEncodingType()java.lang.StringgetMeasurementID()intgetNumOfPages()intgetSerializedSize()static intgetSerializedSize(java.lang.String measurementID)The estimated serialized size of chunk header.static intgetSerializedSize(java.lang.String measurementID, int dataSize)the exact serialized size of chunk header.voidincreasePageNums(int i)voidmergeChunkHeader(ChunkHeader chunkHeader)intserializeTo(java.io.OutputStream outputStream)serialize to outputStream.intserializeTo(java.nio.ByteBuffer buffer)serialize to ByteBuffer.voidsetChunkType(byte chunkType)voidsetDataSize(int dataSize)java.lang.StringtoString()
-
-
-
Constructor Detail
-
ChunkHeader
public ChunkHeader(java.lang.String measurementID, int dataSize, TSDataType dataType, CompressionType compressionType, TSEncoding encoding, int numOfPages)
-
ChunkHeader
public ChunkHeader(java.lang.String measurementID, int dataSize, TSDataType dataType, CompressionType compressionType, TSEncoding encoding, int numOfPages, int mask)
-
ChunkHeader
public ChunkHeader(byte chunkType, java.lang.String measurementID, int dataSize, TSDataType dataType, CompressionType compressionType, TSEncoding encoding)
-
ChunkHeader
public ChunkHeader(byte chunkType, java.lang.String measurementID, int dataSize, int headerSize, TSDataType dataType, CompressionType compressionType, TSEncoding encoding)
-
-
Method Detail
-
getSerializedSize
public static int getSerializedSize(java.lang.String measurementID, int dataSize)the exact serialized size of chunk header.
-
getSerializedSize
public static int getSerializedSize(java.lang.String measurementID)
The estimated serialized size of chunk header. Only used when we don't know the actual dataSize attribute
-
getSerializedSize
public int getSerializedSize()
-
deserializeFrom
public static ChunkHeader deserializeFrom(java.io.InputStream inputStream, byte chunkType) throws java.io.IOException
deserialize from inputStream, the marker has already been read.- Returns:
- ChunkHeader the ChunkHeader read from inputStream
- Throws:
java.io.IOException- exception when reading stream
-
deserializeFrom
public static ChunkHeader deserializeFrom(TsFileInput input, long offset, int chunkHeaderSize) throws java.io.IOException
deserialize from TsFileInput, the marker has not been read.- Parameters:
input- TsFileInputoffset- offsetchunkHeaderSize- the estimated size of chunk's header- Returns:
- CHUNK_HEADER object
- Throws:
java.io.IOException- IOException
-
deserializeCompressionTypeAndEncoding
public static Pair<CompressionType,TSEncoding> deserializeCompressionTypeAndEncoding(java.io.InputStream inputStream) throws java.io.IOException
Used byTsFileSequenceReader.readTimeseriesCompressionTypeAndEncoding(TimeseriesMetadata)to only decode data size,CompressionTypeandTSEncoding.- Parameters:
inputStream- input stream- Returns:
- - Compression type and encoding.
- Throws:
java.io.IOException- - If an I/O error occurs.
-
getMeasurementID
public java.lang.String getMeasurementID()
-
getDataSize
public int getDataSize()
-
getDataType
public TSDataType getDataType()
-
serializeTo
public int serializeTo(java.io.OutputStream outputStream) throws java.io.IOExceptionserialize to outputStream.- Parameters:
outputStream- outputStream- Returns:
- length
- Throws:
java.io.IOException- IOException
-
serializeTo
public int serializeTo(java.nio.ByteBuffer buffer)
serialize to ByteBuffer.- Parameters:
buffer- ByteBuffer- Returns:
- length
-
getNumOfPages
public int getNumOfPages()
-
getCompressionType
public CompressionType getCompressionType()
-
getEncodingType
public TSEncoding getEncodingType()
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
mergeChunkHeader
public void mergeChunkHeader(ChunkHeader chunkHeader)
-
setDataSize
public void setDataSize(int dataSize)
-
getChunkType
public byte getChunkType()
-
setChunkType
public void setChunkType(byte chunkType)
-
increasePageNums
public void increasePageNums(int i)
-
-