Class ChunkHeader


  • public class ChunkHeader
    extends java.lang.Object
    • 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 - TsFileInput
        offset - offset
        chunkHeaderSize - the estimated size of chunk's header
        Returns:
        CHUNK_HEADER object
        Throws:
        java.io.IOException - IOException
      • getMeasurementID

        public java.lang.String getMeasurementID()
      • getDataSize

        public int getDataSize()
      • serializeTo

        public int serializeTo​(java.io.OutputStream outputStream)
                        throws java.io.IOException
        serialize 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()
      • getEncodingType

        public TSEncoding getEncodingType()
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.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)