java.lang.Object
org.elasticsearch.common.bytes.AbstractBytesReference
org.elasticsearch.common.bytes.BytesArray
- All Implemented Interfaces:
Comparable<BytesReference>,BytesReference,ToXContent,ToXContentFragment
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.elasticsearch.xcontent.ToXContent
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.Params -
Field Summary
FieldsFields inherited from class org.elasticsearch.common.bytes.AbstractBytesReference
lengthFields inherited from interface org.elasticsearch.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()intbooleanbyteget(int index) Returns the byte at the specified index.doublegetDoubleLE(int index) Returns the double read from the 8 bytes (LE) starting at the given index.intgetIntLE(int index) Returns the integer read from the 4 bytes (LE) starting at the given index.longgetLongLE(int index) Returns the long read from the 8 bytes (LE) starting at the given index.booleanhasArray()inthashCode()intindexOf(byte marker, int from) Finds the index of the first occurrence of the given marker between within the given bounds.org.apache.lucene.util.BytesRefIteratoriterator()Returns a BytesRefIterator for this BytesReference.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.elasticsearch.common.bytes.AbstractBytesReference
compareTo, getInt, length, toXContent, utf8ToStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.elasticsearch.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. -
indexOf
public int indexOf(byte marker, int from) Description copied from interface:BytesReferenceFinds the index of the first occurrence of the given marker between within the given bounds.- Specified by:
indexOfin interfaceBytesReference- Overrides:
indexOfin classAbstractBytesReference- Parameters:
marker- marker byte to searchfrom- lower bound for the index to check (inclusive)- Returns:
- first index of the marker or
-1if not found
-
hashCode
public int hashCode()- Overrides:
hashCodein classAbstractBytesReference
-
equals
- Overrides:
equalsin classAbstractBytesReference
-
slice
Description copied from interface:BytesReferenceSlice the bytes from thefromindex up tolength. -
hasArray
public boolean hasArray()- Returns:
trueif 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:BytesReferenceConverts to Lucene BytesRef. -
iterator
public org.apache.lucene.util.BytesRefIterator iterator()Description copied from interface:BytesReferenceReturns 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:
-
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
-
getIntLE
public int getIntLE(int index) Description copied from interface:BytesReferenceReturns the integer read from the 4 bytes (LE) starting at the given index.- Specified by:
getIntLEin interfaceBytesReference- Overrides:
getIntLEin classAbstractBytesReference
-
getLongLE
public long getLongLE(int index) Description copied from interface:BytesReferenceReturns the long read from the 8 bytes (LE) starting at the given index.- Specified by:
getLongLEin interfaceBytesReference- Overrides:
getLongLEin classAbstractBytesReference
-
getDoubleLE
public double getDoubleLE(int index) Description copied from interface:BytesReferenceReturns the double read from the 8 bytes (LE) starting at the given index.- Specified by:
getDoubleLEin interfaceBytesReference- Overrides:
getDoubleLEin classAbstractBytesReference
-