Class ReleasableByteArray

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

public class ReleasableByteArray extends Object implements ByteArray
  • Nested Class Summary

    Nested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable

    Writeable.Reader<V>, Writeable.Writer<V>
  • Field Summary

    Fields inherited from interface org.apache.lucene.util.Accountable

    NULL_ACCOUNTABLE
  • Method Summary

    Modifier and Type
    Method
    Description
    byte[]
    Get backing byte array analogous to ByteBuffer.array().
    void
     
    void
    fill(long fromIndex, long toIndex, byte value)
    Fill slots between fromIndex inclusive to toIndex exclusive with value.
    byte
    get(long index)
    Get an element given its index.
    boolean
    get(long index, int len, org.apache.lucene.util.BytesRef ref)
    Get a reference to a slice.
    boolean
    Checks if this instance is backed by a single byte array analogous to ByteBuffer.hasArray().
    long
     
    byte
    set(long index, byte value)
    Set a value at the given index and return the previous value.
    void
    set(long index, byte[] buf, int offset, int len)
    Bulk set.
    long
    Return the length of this array.
    void
    Write this into the StreamOutput.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.apache.lucene.util.Accountable

    getChildResources
  • Method Details

    • 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
    • size

      public long size()
      Description copied from interface: BigArray
      Return the length of this array.
      Specified by:
      size in interface BigArray
    • get

      public byte get(long index)
      Description copied from interface: ByteArray
      Get an element given its index.
      Specified by:
      get in interface ByteArray
    • get

      public boolean get(long index, int len, org.apache.lucene.util.BytesRef ref)
      Description copied from interface: ByteArray
      Get a reference to a slice.
      Specified by:
      get in interface ByteArray
      Returns:
      true when a byte[] was materialized, false otherwise.
    • set

      public byte set(long index, byte value)
      Description copied from interface: ByteArray
      Set a value at the given index and return the previous value.
      Specified by:
      set in interface ByteArray
    • set

      public void set(long index, byte[] buf, int offset, int len)
      Description copied from interface: ByteArray
      Bulk set.
      Specified by:
      set in interface ByteArray
    • fill

      public void fill(long fromIndex, long toIndex, byte value)
      Description copied from interface: ByteArray
      Fill slots between fromIndex inclusive to toIndex exclusive with value.
      Specified by:
      fill in interface ByteArray
    • hasArray

      public boolean hasArray()
      Description copied from interface: ByteArray
      Checks if this instance is backed by a single byte array analogous to ByteBuffer.hasArray().
      Specified by:
      hasArray in interface ByteArray
    • array

      public byte[] array()
      Description copied from interface: ByteArray
      Get backing byte array analogous to ByteBuffer.array().
      Specified by:
      array in interface ByteArray
    • ramBytesUsed

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

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