Class PagedBytes.Reader

    • Field Detail

      • BASE_RAM_BYTES_USED

        private static final long BASE_RAM_BYTES_USED
      • blocks

        private final byte[][] blocks
      • blockBits

        private final int blockBits
      • blockMask

        private final int blockMask
      • blockSize

        private final int blockSize
      • bytesUsedPerBlock

        private final long bytesUsedPerBlock
    • Constructor Detail

      • Reader

        private Reader​(PagedBytes pagedBytes)
    • Method Detail

      • fillSlice

        public void fillSlice​(BytesRef b,
                              long start,
                              int length)
        Gets a slice out of PagedBytes starting at start with a given length. Iff the slice spans across a block border this method will allocate sufficient resources and copy the paged data.

        Slices spanning more than two blocks are not supported.

      • getByte

        public byte getByte​(long o)
        Get the byte at the given offset.
      • fill

        public void fill​(BytesRef b,
                         long start)
        Reads length as 1 or 2 byte vInt prefix, starting at start.

        Note: this method does not support slices spanning across block borders.

      • ramBytesUsed

        public long ramBytesUsed()
        Description copied from interface: Accountable
        Return the memory usage of this object in bytes. Negative values are illegal.
        Specified by:
        ramBytesUsed in interface Accountable
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object