java.lang.Object
org.elasticsearch.common.util.ReleasableByteArray
- All Implemented Interfaces:
Closeable
,AutoCloseable
,org.apache.lucene.util.Accountable
,Writeable
,BigArray
,ByteArray
,Releasable
-
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
close()
void
fill
(long fromIndex, long toIndex, byte value) Fill slots betweenfromIndex
inclusive totoIndex
exclusive withvalue
.void
fillWith
(StreamInput 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.long
byte
set
(long index, byte value) Set a value at the given index and return the previous value.void
set
(long index, byte[] buf, int offset, int len) Bulk set.long
size()
Return the length of this array.void
writeTo
(StreamOutput out) Write this into the StreamOutput.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.apache.lucene.util.Accountable
getChildResources
-
Method Details
-
writeTo
Description copied from interface:Writeable
Write this into the StreamOutput.- Specified by:
writeTo
in interfaceWriteable
- Throws:
IOException
-
size
public long size()Description copied from interface:BigArray
Return the length of this array. -
get
public byte get(long index) Description copied from interface:ByteArray
Get an element given its index. -
get
public boolean get(long index, int len, org.apache.lucene.util.BytesRef ref) Description copied from interface:ByteArray
Get a reference to a slice. -
set
public byte set(long index, byte value) Description copied from interface:ByteArray
Set a value at the given index and return the previous value. -
set
public void set(long index, byte[] buf, int offset, int len) Description copied from interface:ByteArray
Bulk set. -
fill
public void fill(long fromIndex, long toIndex, byte value) Description copied from interface:ByteArray
Fill slots betweenfromIndex
inclusive totoIndex
exclusive withvalue
. -
hasArray
public boolean hasArray()Description copied from interface:ByteArray
Checks if this instance is backed by a single byte array analogous toByteBuffer.hasArray()
. -
array
public byte[] array()Description copied from interface:ByteArray
Get backing byte array analogous toByteBuffer.array()
. -
iterator
public org.apache.lucene.util.BytesRefIterator iterator()Description copied from interface:ByteArray
Returns a BytesRefIterator for this ByteArray. This method allows access to the internal pages of this reference without copying them. -
fillWith
Description copied from interface:ByteArray
Fills this ByteArray with bytes from the given input stream -
ramBytesUsed
public long ramBytesUsed()- Specified by:
ramBytesUsed
in interfaceorg.apache.lucene.util.Accountable
-
close
public void close()- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfaceReleasable
-