- All Superinterfaces:
org.apache.lucene.util.Accountable
,AutoCloseable
,BigArray
,Closeable
,Releasable
,Writeable
- All Known Implementing Classes:
ReleasableByteArray
Abstraction of an array of byte values.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V>
-
Field Summary
Fields inherited from interface org.apache.lucene.util.Accountable
NULL_ACCOUNTABLE
-
Method Summary
Modifier and TypeMethodDescriptionbyte[]
array()
Get backing byte array analogous toByteBuffer.array()
.void
fill
(long fromIndex, long toIndex, byte value) Fill slots betweenfromIndex
inclusive totoIndex
exclusive withvalue
.void
fillWith
(InputStream in) Fills this ByteArray with bytes from the given input streambyte
get
(long index) Get an element given its index.boolean
get
(long index, int len, org.apache.lucene.util.BytesRef ref) Get a reference to a slice.boolean
hasArray()
Checks if this instance is backed by a single byte array analogous toByteBuffer.hasArray()
.org.apache.lucene.util.BytesRefIterator
iterator()
Returns a BytesRefIterator for this ByteArray.static ByteArray
readFrom
(StreamInput in) void
set
(long index, byte value) Set a value at the given index.void
set
(long index, byte[] buf, int offset, int len) Bulk set.Methods inherited from interface org.apache.lucene.util.Accountable
getChildResources, ramBytesUsed
Methods inherited from interface org.elasticsearch.core.Releasable
close
-
Method Details
-
readFrom
- Throws:
IOException
-
get
byte get(long index) Get an element given its index. -
set
void set(long index, byte value) Set a value at the given index. -
get
boolean get(long index, int len, org.apache.lucene.util.BytesRef ref) Get a reference to a slice.- Returns:
true
when a byte[] was materialized,false
otherwise.
-
set
void set(long index, byte[] buf, int offset, int len) Bulk set. -
fill
void fill(long fromIndex, long toIndex, byte value) Fill slots betweenfromIndex
inclusive totoIndex
exclusive withvalue
. -
fillWith
Fills this ByteArray with bytes from the given input stream- Throws:
IOException
-
iterator
org.apache.lucene.util.BytesRefIterator iterator()Returns a BytesRefIterator for this ByteArray. This method allows access to the internal pages of this reference without copying them. -
hasArray
boolean hasArray()Checks if this instance is backed by a single byte array analogous toByteBuffer.hasArray()
. -
array
byte[] array()Get backing byte array analogous toByteBuffer.array()
.
-