Class ByteBuffersDataInput

    • Field Detail

      • blocks

        private final java.nio.ByteBuffer[] blocks
      • blockBits

        private final int blockBits
      • blockMask

        private final int blockMask
      • size

        private final long size
      • offset

        private final long offset
      • pos

        private long pos
    • Constructor Detail

      • ByteBuffersDataInput

        public ByteBuffersDataInput​(java.util.List<java.nio.ByteBuffer> buffers)
        Read data from a set of contiguous buffers. All data buffers except for the last one must have an identical remaining number of bytes in the buffer (that is a power of two). The last buffer can be of an arbitrary remaining length.
    • Method Detail

      • size

        public long size()
      • 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
      • readBytes

        public void readBytes​(java.nio.ByteBuffer buffer,
                              int len)
                       throws java.io.EOFException
        Reads exactly len bytes into the given buffer. The buffer must have enough remaining limit. If there are fewer than len bytes in the input, EOFException is thrown.
        Throws:
        java.io.EOFException
      • readBytes

        public void readBytes​(byte[] arr,
                              int off,
                              int len)
                       throws java.io.EOFException
        Description copied from class: DataInput
        Reads a specified number of bytes into an array at the specified offset.
        Specified by:
        readBytes in class DataInput
        Parameters:
        arr - the array to read bytes into
        off - the offset in the array to start storing bytes
        len - the number of bytes to read
        Throws:
        java.io.EOFException
        See Also:
        DataOutput.writeBytes(byte[],int)
      • position

        public long position()
      • seek

        public void seek​(long position)
                  throws java.io.EOFException
        Throws:
        java.io.EOFException
      • toString

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

        private final int blockIndex​(long pos)
      • blockOffset

        private final int blockOffset​(long pos)
      • blockSize

        private int blockSize()
      • isPowerOfTwo

        private static final boolean isPowerOfTwo​(int v)
      • ensureAssumptions

        private static void ensureAssumptions​(java.util.List<java.nio.ByteBuffer> buffers)
      • determineBlockPage

        static int determineBlockPage​(java.util.List<java.nio.ByteBuffer> buffers)
      • sliceBufferList

        private static java.util.List<java.nio.ByteBuffer> sliceBufferList​(java.util.List<java.nio.ByteBuffer> buffers,
                                                                           long offset,
                                                                           long length)