java.lang.Object
org.elasticsearch.common.util.BytesRefArray
- All Implemented Interfaces:
Closeable
,AutoCloseable
,org.apache.lucene.util.Accountable
,Writeable
,Releasable
public class BytesRefArray
extends Object
implements org.apache.lucene.util.Accountable, Releasable, Writeable
Compact serializable container for ByteRefs
-
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
-
Constructor Summary
ConstructorDescriptionBytesRefArray
(long capacity, BigArrays bigArrays) BytesRefArray
(StreamInput in, BigArrays bigArrays) -
Method Summary
Modifier and TypeMethodDescriptionvoid
append
(org.apache.lucene.util.BytesRef key) long
Memory used by theBigArrays
portion of thisBytesRefArray
.void
close()
org.apache.lucene.util.BytesRef
get
(long id, org.apache.lucene.util.BytesRef dest) Return the key at0 <= index <= capacity()
.long
long
size()
static BytesRefArray
takeOwnershipOf
(BytesRefArray other) Create new instance and pass ownership of this array to the new one.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
-
Constructor Details
-
BytesRefArray
-
BytesRefArray
- Throws:
IOException
-
-
Method Details
-
append
public void append(org.apache.lucene.util.BytesRef key) -
get
public org.apache.lucene.util.BytesRef get(long id, org.apache.lucene.util.BytesRef dest) Return the key at0 <= index <= capacity()
. The result is undefined if the slot is unused.Beware that the content of the
BytesRef
may become invalid as soon asclose()
is called -
size
public long size() -
close
public void close()- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfaceReleasable
-
takeOwnershipOf
Create new instance and pass ownership of this array to the new one. Note, this closes this array. Don't use it after passing ownership.- Parameters:
other
- BytesRefArray to claim ownership from- Returns:
- a new BytesRefArray instance with the payload of other
-
writeTo
Description copied from interface:Writeable
Write this into the StreamOutput.- Specified by:
writeTo
in interfaceWriteable
- Throws:
IOException
-
ramBytesUsed
public long ramBytesUsed()- Specified by:
ramBytesUsed
in interfaceorg.apache.lucene.util.Accountable
-
bigArraysRamBytesUsed
public long bigArraysRamBytesUsed()Memory used by theBigArrays
portion of thisBytesRefArray
.
-