Class BytesReference

    • Constructor Detail

      • BytesReference

        public BytesReference()
    • Method Detail

      • get

        public abstract byte get​(int index)
        Returns the byte at the specified index. Need to be between 0 and length.
      • getInt

        public int getInt​(int index)
        Returns the integer read from the 4 bytes (BE) starting at the given index.
      • indexOf

        public int indexOf​(byte marker,
                           int from)
        Finds the index of the first occurrence of the given marker between within the given bounds.
        marker - marker byte to search
        from - lower bound for the index to check (inclusive)
        first index of the marker or -1 if not found
      • length

        public abstract int length()
        The length.
      • slice

        public abstract BytesReference slice​(int from,
                                             int length)
        Slice the bytes from the from index up to length.
      • ramBytesUsed

        public abstract long ramBytesUsed()
        The amount of memory used by this BytesReference
      • streamInput

        public StreamInput streamInput()
        A stream input of the bytes.
      • writeTo

        public void writeTo​( os)
        Writes the bytes directly to the output stream.
      • utf8ToString

        public java.lang.String utf8ToString()
        Interprets the referenced bytes as UTF8 bytes, returning the resulting string
      • toBytesRef

        public abstract org.apache.lucene.util.BytesRef toBytesRef()
        Converts to Lucene BytesRef.
      • iterator

        public org.apache.lucene.util.BytesRefIterator iterator()
        Returns a BytesRefIterator for this BytesReference. This method allows access to the internal pages of this reference without copying them. Use with care!
        See Also:
      • equals

        public boolean equals​(java.lang.Object other)
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        hashCode in class java.lang.Object
      • toBytes

        public static byte[] toBytes​(BytesReference reference)
        Returns a compact array from the given BytesReference. The returned array won't be copied unless necessary. If you need to modify the returned array use BytesRef.deepCopyOf(reference.toBytesRef() instead
      • toByteBuffers

        public static java.nio.ByteBuffer[] toByteBuffers​(BytesReference reference)
        Returns an array of byte buffers from the given BytesReference.
      • fromByteBuffers

        public static BytesReference fromByteBuffers​(java.nio.ByteBuffer[] buffers)
        Returns BytesReference composed of the provided ByteBuffers.