Package org.opensearch.core.common.bytes
Class BytesArray
java.lang.Object
org.opensearch.core.common.bytes.AbstractBytesReference
org.opensearch.core.common.bytes.BytesArray
- All Implemented Interfaces:
Comparable<BytesReference>,BytesReference,ToXContent,ToXContentFragment
A bytes array.
- Opensearch.internal:
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.opensearch.core.xcontent.ToXContent
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.Params -
Field Summary
FieldsFields inherited from interface org.opensearch.core.xcontent.ToXContent
EMPTY_PARAMS -
Constructor Summary
ConstructorsConstructorDescriptionBytesArray(byte[] bytes) BytesArray(byte[] bytes, int offset, int length) BytesArray(String bytes) BytesArray(org.apache.lucene.util.BytesRef bytesRef) BytesArray(org.apache.lucene.util.BytesRef bytesRef, boolean deepCopy) -
Method Summary
Modifier and TypeMethodDescriptionbyte[]array()booleanbyteget(int index) Returns the byte at the specified index.intgetInt(int index) Returns the integer read from the 4 bytes (big endian) starting at the given index.inthashCode()intlength()The length.intoffset()longThe amount of memory used by this BytesReferenceslice(int from, int length) Slice the bytes from thefromindex up tolength.A stream input of the bytes.org.apache.lucene.util.BytesRefConverts to Lucene BytesRef.voidwriteTo(OutputStream os) Writes the bytes directly to the output stream.Methods inherited from class org.opensearch.core.common.bytes.AbstractBytesReference
compareTo, getMaxUTF16Length, indexOf, iterator, toXContent, utf8ToStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.opensearch.core.xcontent.ToXContentFragment
isFragment
-
Field Details
-
EMPTY
-
-
Constructor Details
-
BytesArray
-
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:BytesReferenceReturns the byte at the specified index. Need to be between 0 and length. -
getInt
public int getInt(int index) Description copied from interface:BytesReferenceReturns the integer read from the 4 bytes (big endian) starting at the given index. -
length
public int length()Description copied from interface:BytesReferenceThe length. -
hashCode
public int hashCode()- Overrides:
hashCodein classAbstractBytesReference
-
equals
- Overrides:
equalsin classAbstractBytesReference
-
slice
Description copied from interface:BytesReferenceSlice the bytes from thefromindex up tolength. -
array
public byte[] array() -
offset
public int offset() -
toBytesRef
public org.apache.lucene.util.BytesRef toBytesRef()Description copied from interface:BytesReferenceConverts to Lucene BytesRef. -
ramBytesUsed
public long ramBytesUsed()Description copied from interface:BytesReferenceThe amount of memory used by this BytesReference -
streamInput
Description copied from interface:BytesReferenceA stream input of the bytes.- Specified by:
streamInputin interfaceBytesReference- Overrides:
streamInputin classAbstractBytesReference
-
writeTo
Description copied from interface:BytesReferenceWrites the bytes directly to the output stream.- Specified by:
writeToin interfaceBytesReference- Overrides:
writeToin classAbstractBytesReference- Throws:
IOException
-