Class GrowableByteArrayDataOutput

java.lang.Object
org.apache.lucene.store.DataOutput
org.apache.lucene.util.fst.GrowableByteArrayDataOutput
All Implemented Interfaces:
Accountable

final class GrowableByteArrayDataOutput extends DataOutput implements Accountable
  • Field Details

    • BASE_RAM_BYTES_USED

      private static final long BASE_RAM_BYTES_USED
    • INITIAL_SIZE

      private static final int INITIAL_SIZE
      See Also:
    • bytes

      private byte[] bytes
    • nextWrite

      private int nextWrite
  • Constructor Details

    • GrowableByteArrayDataOutput

      GrowableByteArrayDataOutput()
  • Method Details

    • 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:
    • 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:
    • 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 IOException
      Writes all of our bytes to the target DataOutput.
      Throws:
      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