Class BytesRefArray

java.lang.Object
org.elasticsearch.common.util.BytesRefArray
All Implemented Interfaces:
Closeable, AutoCloseable, org.apache.lucene.util.Accountable, Writeable, Releasable

public final class BytesRefArray extends Object implements org.apache.lucene.util.Accountable, Releasable, Writeable
Compact serializable container for ByteRefs
  • Constructor Details

  • Method Details

    • append

      public void append(org.apache.lucene.util.BytesRef key)
    • get

      public org.apache.lucene.util.BytesRef get(long id, org.apache.lucene.util.BytesRef dest)
      Return the key at 0 <= index <= capacity(). The result is undefined if the slot is unused.

      Beware that the content of the BytesRef may become invalid as soon as close() is called

    • size

      public long size()
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Specified by:
      close in interface Releasable
    • takeOwnershipOf

      public static BytesRefArray takeOwnershipOf(BytesRefArray other)
      Create new instance and pass ownership of this array to the new one. Note, this closes this array. Don't use it after passing ownership.
      Parameters:
      other - BytesRefArray to claim ownership from
      Returns:
      a new BytesRefArray instance with the payload of other
    • writeTo

      public void writeTo(StreamOutput out) throws IOException
      Description copied from interface: Writeable
      Write this into the StreamOutput.
      Specified by:
      writeTo in interface Writeable
      Throws:
      IOException
    • ramBytesUsed

      public long ramBytesUsed()
      Specified by:
      ramBytesUsed in interface org.apache.lucene.util.Accountable
    • bigArraysRamBytesUsed

      public long bigArraysRamBytesUsed()
      Memory used by the BigArrays portion of this BytesRefArray.