java.lang.Object
org.elasticsearch.common.bytes.AbstractBytesReference
- All Implemented Interfaces:
Comparable<BytesReference>
,BytesReference
,ToXContent
,ToXContentFragment
- Direct Known Subclasses:
BytesArray
,CompositeBytesReference
,PagedBytesReference
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.elasticsearch.xcontent.ToXContent
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.Params
-
Field Summary
FieldsFields inherited from interface org.elasticsearch.xcontent.ToXContent
EMPTY, EMPTY_PARAMS
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
compareTo
(BytesReference other) boolean
double
getDoubleLE
(int index) Returns the double read from the 8 bytes (LE) starting at the given index.int
getInt
(int index) Returns the integer read from the 4 bytes (BE) starting at the given index.int
getIntLE
(int index) Returns the integer read from the 4 bytes (LE) starting at the given index.long
getLongLE
(int index) Returns the long read from the 8 bytes (LE) starting at the given index.int
hashCode()
int
indexOf
(byte marker, int from) Finds the index of the first occurrence of the given marker between within the given bounds.org.apache.lucene.util.BytesRefIterator
iterator()
Returns a BytesRefIterator for this BytesReference.final int
length()
The length.A stream input of the bytes.toXContent
(XContentBuilder builder, ToXContent.Params params) Interprets the referenced bytes as UTF8 bytes, returning the resulting stringvoid
writeTo
(OutputStream os) Writes the bytes directly to the output stream.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.elasticsearch.common.bytes.BytesReference
array, arrayOffset, get, hasArray, ramBytesUsed, slice, toBytesRef
Methods inherited from interface org.elasticsearch.xcontent.ToXContentFragment
isFragment
-
Field Details
-
length
protected final int length
-
-
Constructor Details
-
AbstractBytesReference
protected AbstractBytesReference(int length)
-
-
Method Details
-
length
public final int length()Description copied from interface:BytesReference
The length.- Specified by:
length
in interfaceBytesReference
-
getInt
public int getInt(int index) Description copied from interface:BytesReference
Returns the integer read from the 4 bytes (BE) starting at the given index.- Specified by:
getInt
in interfaceBytesReference
-
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 interfaceBytesReference
-
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 interfaceBytesReference
-
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 interfaceBytesReference
-
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 interfaceBytesReference
- Parameters:
marker
- marker byte to searchfrom
- lower bound for the index to check (inclusive)- Returns:
- first index of the marker or
-1
if not found
-
streamInput
Description copied from interface:BytesReference
A stream input of the bytes.- Specified by:
streamInput
in interfaceBytesReference
- Throws:
IOException
-
writeTo
Description copied from interface:BytesReference
Writes the bytes directly to the output stream.- Specified by:
writeTo
in interfaceBytesReference
- Throws:
IOException
-
utf8ToString
Description copied from interface:BytesReference
Interprets the referenced bytes as UTF8 bytes, returning the resulting string- Specified by:
utf8ToString
in interfaceBytesReference
-
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. Use with care!- Specified by:
iterator
in interfaceBytesReference
- See Also:
-
BytesRefIterator
-
equals
-
hashCode
public int hashCode() -
compareTo
- Specified by:
compareTo
in interfaceComparable<BytesReference>
-
toXContent
public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws IOException - Specified by:
toXContent
in interfaceToXContent
- Throws:
IOException
-