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
ConstructorsConstructorDescriptionBytesRefArray(long capacity, BigArrays bigArrays) BytesRefArray(StreamInput in, BigArrays bigArrays) -
Method Summary
Modifier and TypeMethodDescriptionvoidappend(org.apache.lucene.util.BytesRef key) voidclose()org.apache.lucene.util.BytesRefget(long id, org.apache.lucene.util.BytesRef dest) Return the key at0 <= index <= capacity().longlongsize()static BytesRefArraytakeOwnershipOf(BytesRefArray other) Create new instance and pass ownership of this array to the new one.voidwriteTo(StreamOutput out) Write this into the StreamOutput.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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
BytesRefmay become invalid as soon asclose()is called -
size
public long size() -
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein 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:WriteableWrite this into the StreamOutput.- Specified by:
writeToin interfaceWriteable- Throws:
IOException
-
ramBytesUsed
public long ramBytesUsed()- Specified by:
ramBytesUsedin interfaceorg.apache.lucene.util.Accountable
-