Package org.elasticsearch.common.bytes
Class BytesArray
java.lang.Object
org.elasticsearch.common.bytes.AbstractBytesReference
org.elasticsearch.common.bytes.BytesArray
- All Implemented Interfaces:
java.lang.Comparable<BytesReference>,BytesReference,ToXContent,ToXContentFragment
public final class BytesArray extends AbstractBytesReference
-
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 BytesArrayEMPTY -
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()byteget(int index)Returns the byte at the specified index.intlength()The length.intoffset()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()Converts to Lucene BytesRef.Methods inherited from class org.elasticsearch.common.bytes.AbstractBytesReference
compareTo, equals, getInt, hashCode, indexOf, iterator, streamInput, toXContent, utf8ToString, writeTo
-
Field Details
-
Constructor Details
-
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 Details
-
get
public byte get(int index)Description copied from interface:BytesReferenceReturns the byte at the specified index. Need to be between 0 and length. -
length
public int length()Description copied from interface:BytesReferenceThe length. -
slice
Description copied from interface:BytesReferenceSlice the bytes from thefromindex up tolength. -
array
public byte[] array() -
offset
public int offset() -
toBytesRef
public org.apache.lucene.util.BytesRef toBytesRef()Description copied from interface:BytesReferenceConverts to Lucene BytesRef. -
ramBytesUsed
public long ramBytesUsed()Description copied from interface:BytesReferenceThe amount of memory used by this BytesReference
-