Class PageWriter


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

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      long estimateMaxMemSize()
      calculate max possible memory size it occupies, including time outputStream and value outputStream, because size outputStream is never used until flushing.
      long getPointNumber()  
      Statistics<? extends java.io.Serializable> getStatistics()  
      java.nio.ByteBuffer getUncompressedBytes()
      getUncompressedBytes return data what it has been written in form of size of time list, time list, value list
      void initStatistics​(TSDataType dataType)  
      void reset​(IMeasurementSchema measurementSchema)
      reset this page
      void setTimeEncoder​(Encoder encoder)  
      void setValueEncoder​(Encoder encoder)  
      void write​(long[] timestamps, boolean[] values, int batchSize)
      write time series into encoder
      void write​(long[] timestamps, double[] values, int batchSize)
      write time series into encoder
      void write​(long[] timestamps, float[] values, int batchSize)
      write time series into encoder
      void write​(long[] timestamps, int[] values, int batchSize)
      write time series into encoder
      void write​(long[] timestamps, long[] values, int batchSize)
      write time series into encoder
      void write​(long[] timestamps, Binary[] values, int batchSize)
      write time series into encoder
      void write​(long time, boolean value)
      write a time value pair into encoder
      void write​(long time, double value)
      write a time value pair into encoder
      void write​(long time, float value)
      write a time value pair into encoder
      void write​(long time, int value)
      write a time value pair into encoder
      void write​(long time, long value)
      write a time value pair into encoder
      void write​(long time, short value)
      write a time value pair into encoder
      void write​(long time, Binary value)
      write a time value pair into encoder
      int writePageHeaderAndDataIntoBuff​(PublicBAOS pageBuffer, boolean first)
      write the page header and data into the PageWriter's output stream.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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 java.nio.ByteBuffer getUncompressedBytes()
                                                 throws java.io.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:
        java.io.IOException
      • writePageHeaderAndDataIntoBuff

        public int writePageHeaderAndDataIntoBuff​(PublicBAOS pageBuffer,
                                                  boolean first)
                                           throws java.io.IOException
        write the page header and data into the PageWriter's output stream.
        Throws:
        java.io.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()
      • getStatistics

        public Statistics<? extends java.io.Serializable> getStatistics()