Package org.elasticsearch.common.bytes
Class BytesArray
- java.lang.Object
-
- org.elasticsearch.common.bytes.BytesReference
-
- org.elasticsearch.common.bytes.BytesArray
-
- All Implemented Interfaces:
java.lang.Comparable<BytesReference>
,ToXContent
,ToXContentFragment
public final class BytesArray extends BytesReference
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.elasticsearch.common.xcontent.ToXContent
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.Params
-
-
Field Summary
Fields Modifier and Type Field Description static BytesArray
EMPTY
-
Fields inherited from interface org.elasticsearch.common.xcontent.ToXContent
EMPTY_PARAMS
-
-
Constructor Summary
Constructors Constructor Description BytesArray(byte[] bytes)
BytesArray(byte[] bytes, int offset, int length)
BytesArray(java.lang.String bytes)
BytesArray(org.apache.lucene.util.BytesRef bytesRef)
BytesArray(org.apache.lucene.util.BytesRef bytesRef, boolean deepCopy)
-
Method Summary
Modifier and Type Method Description byte[]
array()
byte
get(int index)
Returns the byte at the specified index.int
length()
The length.int
offset()
long
ramBytesUsed()
The amount of memory used by this BytesReferenceBytesReference
slice(int from, int length)
Slice the bytes from thefrom
index up tolength
.org.apache.lucene.util.BytesRef
toBytesRef()
Converts to Lucene BytesRef.-
Methods inherited from class org.elasticsearch.common.bytes.BytesReference
bytes, compareTo, equals, hashCode, iterator, streamInput, 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
-
-
-
-
Field Detail
-
EMPTY
public static final BytesArray EMPTY
-
-
Constructor Detail
-
BytesArray
public BytesArray(java.lang.String bytes)
-
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 Detail
-
get
public byte get(int index)
Description copied from class:BytesReference
Returns the byte at the specified index. Need to be between 0 and length.- Specified by:
get
in classBytesReference
-
length
public int length()
Description copied from class:BytesReference
The length.- Specified by:
length
in classBytesReference
-
slice
public BytesReference slice(int from, int length)
Description copied from class:BytesReference
Slice the bytes from thefrom
index up tolength
.- Specified by:
slice
in classBytesReference
-
array
public byte[] array()
-
offset
public int offset()
-
toBytesRef
public org.apache.lucene.util.BytesRef toBytesRef()
Description copied from class:BytesReference
Converts to Lucene BytesRef.- Specified by:
toBytesRef
in classBytesReference
-
ramBytesUsed
public long ramBytesUsed()
Description copied from class:BytesReference
The amount of memory used by this BytesReference- Specified by:
ramBytesUsed
in classBytesReference
-
-