Class BytesArray

All Implemented Interfaces:
Comparable<BytesReference>, BytesReference, ToXContent, ToXContentFragment

public final class BytesArray extends AbstractBytesReference
  • Field Details

  • Constructor Details

    • BytesArray

      public BytesArray(String bytes)
    • BytesArray

      public BytesArray(org.apache.lucene.util.BytesRef bytesRef)
    • BytesArray

      public BytesArray(org.apache.lucene.util.BytesRef bytesRef, boolean deepCopy)
    • BytesArray

      public BytesArray(byte[] bytes)
    • BytesArray

      public BytesArray(byte[] bytes, int offset, int length)
  • Method Details

    • get

      public byte get(int index)
      Description copied from interface: BytesReference
      Returns the byte at the specified index. Need to be between 0 and length.
    • indexOf

      public int indexOf(byte marker, int from)
      Description copied from interface: BytesReference
      Finds the index of the first occurrence of the given marker between within the given bounds.
      Specified by:
      indexOf in interface BytesReference
      Overrides:
      indexOf in class AbstractBytesReference
      Parameters:
      marker - marker byte to search
      from - lower bound for the index to check (inclusive)
      Returns:
      first index of the marker or -1 if not found
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class AbstractBytesReference
    • equals

      public boolean equals(Object other)
      Overrides:
      equals in class AbstractBytesReference
    • slice

      public BytesReference slice(int from, int length)
      Description copied from interface: BytesReference
      Slice the bytes from the from index up to length.
    • hasArray

      public boolean hasArray()
      Returns:
      true if this instance is backed by a byte array
    • array

      public byte[] array()
      Returns:
      backing byte array for this instance
    • arrayOffset

      public int arrayOffset()
      Returns:
      offset of the first byte of this instance in the backing byte array
    • toBytesRef

      public org.apache.lucene.util.BytesRef toBytesRef()
      Description copied from interface: BytesReference
      Converts to Lucene BytesRef.
    • iterator

      public org.apache.lucene.util.BytesRefIterator iterator()
      Description copied from interface: BytesReference
      Returns a BytesRefIterator for this BytesReference. This method allows access to the internal pages of this reference without copying them. It must return direct references to the pages, not copies. Use with care!
      See Also:
      • BytesRefIterator
    • ramBytesUsed

      public long ramBytesUsed()
      Description copied from interface: BytesReference
      The amount of memory used by this BytesReference
    • streamInput

      public StreamInput streamInput()
      Description copied from interface: BytesReference
      A stream input of the bytes.
      Specified by:
      streamInput in interface BytesReference
      Overrides:
      streamInput in class AbstractBytesReference
    • writeTo

      public void writeTo(OutputStream os) throws IOException
      Description copied from interface: BytesReference
      Writes the bytes directly to the output stream.
      Specified by:
      writeTo in interface BytesReference
      Overrides:
      writeTo in class AbstractBytesReference
      Throws:
      IOException
    • getIntLE

      public int getIntLE(int index)
      Description copied from interface: BytesReference
      Returns the integer read from the 4 bytes (LE) starting at the given index.
      Specified by:
      getIntLE in interface BytesReference
      Overrides:
      getIntLE in class AbstractBytesReference
    • getLongLE

      public long getLongLE(int index)
      Description copied from interface: BytesReference
      Returns the long read from the 8 bytes (LE) starting at the given index.
      Specified by:
      getLongLE in interface BytesReference
      Overrides:
      getLongLE in class AbstractBytesReference
    • getDoubleLE

      public double getDoubleLE(int index)
      Description copied from interface: BytesReference
      Returns the double read from the 8 bytes (LE) starting at the given index.
      Specified by:
      getDoubleLE in interface BytesReference
      Overrides:
      getDoubleLE in class AbstractBytesReference