java.lang.Comparable<BytesReference>
, org.apache.lucene.util.Accountable
, ToXContent
, ToXContentFragment
public class ByteBufferReference extends BytesReference
BytesReference
backed by a ByteBuffer
. The byte buffer can either be a heap or
direct byte buffer. The reference is composed of the space between the ByteBuffer.position(int)
and
ByteBuffer.limit(int)
at construction time. If the position or limit of the underlying byte buffer is
changed, those changes will not be reflected in this reference. However, modifying the limit or position
of the underlying byte buffer is not recommended as those can be used during ByteBuffer.get()
bounds checks. Use ByteBuffer.duplicate()
at creation time if you plan on modifying the markers of
the underlying byte buffer. Any changes to the underlying data in the byte buffer will be reflected.ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.Params
EMPTY_PARAMS
Constructor | Description |
---|---|
ByteBufferReference(java.nio.ByteBuffer buffer) |
Modifier and Type | Method | Description |
---|---|---|
byte |
get(int index) |
Returns the byte at the specified index.
|
int |
length() |
The length.
|
long |
ramBytesUsed() |
|
BytesReference |
slice(int from,
int length) |
Slice the bytes from the from index up to length.
|
org.apache.lucene.util.BytesRef |
toBytesRef() |
This will return a bytes ref composed of the bytes.
|
bytes, compareTo, equals, hashCode, iterator, streamInput, toBytes, toXContent, utf8ToString, writeTo
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
isFragment
public byte get(int index)
BytesReference
get
in class BytesReference
public int length()
BytesReference
length
in class BytesReference
public BytesReference slice(int from, int length)
BytesReference
slice
in class BytesReference
public org.apache.lucene.util.BytesRef toBytesRef()
toBytesRef
in class BytesReference
public long ramBytesUsed()