Class PageWriter


  • public class PageWriter
    extends Object
    This writer is used to write time-value into a page. It consists of a time encoder, a value encoder and respective OutputStream.
    • Constructor Detail

      • PageWriter

        public PageWriter()
    • Method Detail

      • write

        public void write​(long time,
                          boolean value)
        write a time value pair into encoder
      • write

        public void write​(long time,
                          short value)
        write a time value pair into encoder
      • write

        public void write​(long time,
                          int value)
        write a time value pair into encoder
      • write

        public void write​(long time,
                          long value)
        write a time value pair into encoder
      • write

        public void write​(long time,
                          float value)
        write a time value pair into encoder
      • write

        public void write​(long time,
                          double value)
        write a time value pair into encoder
      • write

        public void write​(long time,
                          Binary value)
        write a time value pair into encoder
      • write

        public void write​(long[] timestamps,
                          boolean[] values,
                          int batchSize)
        write time series into encoder
      • write

        public void write​(long[] timestamps,
                          int[] values,
                          int batchSize)
        write time series into encoder
      • write

        public void write​(long[] timestamps,
                          long[] values,
                          int batchSize)
        write time series into encoder
      • write

        public void write​(long[] timestamps,
                          float[] values,
                          int batchSize)
        write time series into encoder
      • write

        public void write​(long[] timestamps,
                          double[] values,
                          int batchSize)
        write time series into encoder
      • write

        public void write​(long[] timestamps,
                          Binary[] values,
                          int batchSize)
        write time series into encoder
      • getUncompressedBytes

        public ByteBuffer getUncompressedBytes()
                                        throws IOException
        getUncompressedBytes return data what it has been written in form of size of time list, time list, value list
        Returns:
        a new readable ByteBuffer whose position is 0.
        Throws:
        IOException
      • writePageHeaderAndDataIntoBuff

        public int writePageHeaderAndDataIntoBuff​(PublicBAOS pageBuffer,
                                                  boolean first)
                                           throws IOException
        write the page header and data into the PageWriter's output stream.
        Throws:
        IOException
      • estimateMaxMemSize

        public long estimateMaxMemSize()
        calculate max possible memory size it occupies, including time outputStream and value outputStream, because size outputStream is never used until flushing.
        Returns:
        allocated size in time, value and outputStream
      • setTimeEncoder

        public void setTimeEncoder​(Encoder encoder)
      • setValueEncoder

        public void setValueEncoder​(Encoder encoder)
      • initStatistics

        public void initStatistics​(TSDataType dataType)
      • getPointNumber

        public long getPointNumber()