Package org.elasticsearch.common.bytes
Class CompositeBytesReference
java.lang.Object
org.elasticsearch.common.bytes.AbstractBytesReference
org.elasticsearch.common.bytes.CompositeBytesReference
- All Implemented Interfaces:
Comparable<BytesReference>
,BytesReference
,org.elasticsearch.common.xcontent.ToXContent
,org.elasticsearch.common.xcontent.ToXContentFragment
A composite
BytesReference
that allows joining multiple bytes references
into one without copying.
Note, toBytesRef()
will materialize all pages in this BytesReference.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.elasticsearch.common.xcontent.ToXContent
org.elasticsearch.common.xcontent.ToXContent.DelegatingMapParams, org.elasticsearch.common.xcontent.ToXContent.MapParams, org.elasticsearch.common.xcontent.ToXContent.Params
-
Field Summary
Fields inherited from interface org.elasticsearch.common.xcontent.ToXContent
EMPTY_PARAMS
-
Method Summary
Modifier and TypeMethodDescriptionbyte
get(int index)
Returns the byte at the specified index.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.int
length()
The length.static BytesReference
of(BytesReference... references)
long
The amount of memory used by this BytesReferenceslice(int from, int length)
Slice the bytes from thefrom
index up tolength
.org.apache.lucene.util.BytesRef
Converts to Lucene BytesRef.void
writeTo(OutputStream os)
Writes the bytes directly to the output stream.Methods inherited from class org.elasticsearch.common.bytes.AbstractBytesReference
compareTo, equals, getInt, hashCode, streamInput, toXContent, utf8ToString
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, hasArray
Methods inherited from interface org.elasticsearch.common.xcontent.ToXContentFragment
isFragment
-
Method Details
-
of
-
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 interfaceBytesReference
- Overrides:
indexOf
in classAbstractBytesReference
- 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
-
length
public int length()Description copied from interface:BytesReference
The length. -
slice
Description copied from interface:BytesReference
Slice the bytes from thefrom
index up tolength
. -
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. Use with care!- Specified by:
iterator
in interfaceBytesReference
- Overrides:
iterator
in classAbstractBytesReference
- See Also:
BytesRefIterator
-
writeTo
Description copied from interface:BytesReference
Writes the bytes directly to the output stream.- Specified by:
writeTo
in interfaceBytesReference
- Overrides:
writeTo
in classAbstractBytesReference
- Throws:
IOException
-
ramBytesUsed
public long ramBytesUsed()Description copied from interface:BytesReference
The amount of memory used by this BytesReference
-