Package org.elasticsearch.common.bytes
Class ByteBufferReference
- java.lang.Object
-
- org.elasticsearch.common.bytes.BytesReference
-
- org.elasticsearch.common.bytes.ByteBufferReference
-
- All Implemented Interfaces:
java.lang.Comparable<BytesReference>,ToXContent,ToXContentFragment
public class ByteBufferReference extends BytesReference
This is aBytesReferencebacked by aByteBuffer. The byte buffer can either be a heap or direct byte buffer. The reference is composed of the space between theBuffer.position()andBuffer.limit()at construction time. If the position or limit of the underlying byte buffer is changed, those changes will not be reflected in this reference. Any changes to the underlying data in the byte buffer will be reflected in this reference.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.elasticsearch.common.xcontent.ToXContent
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.Params
-
-
Field Summary
-
Fields inherited from interface org.elasticsearch.common.xcontent.ToXContent
EMPTY_PARAMS
-
-
Method Summary
Modifier and Type Method Description byteget(int index)Returns the byte at the specified index.intlength()The length.longramBytesUsed()The amount of memory used by this BytesReferenceBytesReferenceslice(int from, int length)Slice the bytes from thefromindex up tolength.org.apache.lucene.util.BytesReftoBytesRef()This will return a bytes ref composed of the bytes.-
Methods inherited from class org.elasticsearch.common.bytes.BytesReference
bytes, compareTo, equals, fromByteBuffers, hashCode, iterator, streamInput, toByteBuffers, toBytes, toXContent, utf8ToString, writeTo
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.elasticsearch.common.xcontent.ToXContentFragment
isFragment
-
-
-
-
Method Detail
-
get
public byte get(int index)
Description copied from class:BytesReferenceReturns the byte at the specified index. Need to be between 0 and length.- Specified by:
getin classBytesReference
-
length
public int length()
Description copied from class:BytesReferenceThe length.- Specified by:
lengthin classBytesReference
-
slice
public BytesReference slice(int from, int length)
Description copied from class:BytesReferenceSlice the bytes from thefromindex up tolength.- Specified by:
slicein classBytesReference
-
toBytesRef
public org.apache.lucene.util.BytesRef toBytesRef()
This will return a bytes ref composed of the bytes. If this is a direct byte buffer, the bytes will have to be copied.- Specified by:
toBytesRefin classBytesReference- Returns:
- the bytes ref
-
ramBytesUsed
public long ramBytesUsed()
Description copied from class:BytesReferenceThe amount of memory used by this BytesReference- Specified by:
ramBytesUsedin classBytesReference
-
-