Class GrowableByteArrayDataOutput

    • Field Detail

      • BASE_RAM_BYTES_USED

        private static final long BASE_RAM_BYTES_USED
      • bytes

        private byte[] bytes
      • nextWrite

        private int nextWrite
    • Constructor Detail

      • GrowableByteArrayDataOutput

        GrowableByteArrayDataOutput()
    • Method Detail

      • writeByte

        public void writeByte​(byte b)
        Description copied from class: DataOutput
        Writes a single byte.

        The most primitive data type is an eight-bit byte. Files are accessed as sequences of bytes. All other data types are defined as sequences of bytes, so file formats are byte-order independent.

        Specified by:
        writeByte in class DataOutput
        See Also:
        DataInput.readByte()
      • writeBytes

        public void writeBytes​(byte[] b,
                               int offset,
                               int len)
        Description copied from class: DataOutput
        Writes an array of bytes.
        Specified by:
        writeBytes in class DataOutput
        Parameters:
        b - the bytes to write
        offset - the offset in the byte array
        len - the number of bytes to write
        See Also:
        DataInput.readBytes(byte[],int,int)
      • getPosition

        public int getPosition()
      • getBytes

        public byte[] getBytes()
      • setPosition

        public void setPosition​(int newLen)
        Set the position of the byte[], increasing the capacity if needed
      • ensureCapacity

        private void ensureCapacity​(int capacityToWrite)
        Ensure we can write additional capacityToWrite bytes.
        Parameters:
        capacityToWrite - the additional bytes to write
      • writeTo

        public void writeTo​(DataOutput out)
                     throws java.io.IOException
        Writes all of our bytes to the target DataOutput.
        Throws:
        java.io.IOException
      • writeTo

        public void writeTo​(int srcOffset,
                            byte[] dest,
                            int destOffset,
                            int len)
        Copies bytes from this store to a target byte array.
      • 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