Package org.opensearch.common.bytes
Class AbstractBytesReference
java.lang.Object
org.opensearch.common.bytes.AbstractBytesReference
- All Implemented Interfaces:
java.lang.Comparable<BytesReference>
,BytesReference
,org.opensearch.common.xcontent.ToXContent
,org.opensearch.common.xcontent.ToXContentFragment
- Direct Known Subclasses:
BytesArray
,CompositeBytesReference
,PagedBytesReference
public abstract class AbstractBytesReference extends java.lang.Object implements BytesReference
-
Nested Class Summary
-
Field Summary
-
Constructor Summary
Constructors Constructor Description AbstractBytesReference()
-
Method Summary
Modifier and Type Method Description int
compareTo(BytesReference other)
boolean
equals(java.lang.Object other)
int
getInt(int index)
Returns the integer read from the 4 bytes (BE) starting at the given index.int
hashCode()
int
indexOf(byte marker, int from)
Finds the index of the first occurrence of the given marker between within the given bounds.org.apache.lucene.util.BytesRefIterator
iterator()
Returns a BytesRefIterator for this BytesReference.StreamInput
streamInput()
A stream input of the bytes.org.opensearch.common.xcontent.XContentBuilder
toXContent(org.opensearch.common.xcontent.XContentBuilder builder, org.opensearch.common.xcontent.ToXContent.Params params)
java.lang.String
utf8ToString()
Interprets the referenced bytes as UTF8 bytes, returning the resulting stringvoid
writeTo(java.io.OutputStream os)
Writes the bytes directly to the output stream.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.opensearch.common.bytes.BytesReference
get, length, ramBytesUsed, slice, toBytesRef
-
Constructor Details
-
AbstractBytesReference
public AbstractBytesReference()
-
-
Method Details
-
getInt
public int getInt(int index)Description copied from interface:BytesReference
Returns the integer read from the 4 bytes (BE) starting at the given index.- Specified by:
getInt
in interfaceBytesReference
-
indexOf
public int indexOf(byte marker, int from)Description copied from interface:BytesReference
Finds the index of the first occurrence of the given marker between within the given bounds.- Specified by:
indexOf
in interfaceBytesReference
- Parameters:
marker
- marker byte to searchfrom
- lower bound for the index to check (inclusive)- Returns:
- first index of the marker or
-1
if not found
-
streamInput
Description copied from interface:BytesReference
A stream input of the bytes.- Specified by:
streamInput
in interfaceBytesReference
- Throws:
java.io.IOException
-
writeTo
public void writeTo(java.io.OutputStream os) throws java.io.IOExceptionDescription copied from interface:BytesReference
Writes the bytes directly to the output stream.- Specified by:
writeTo
in interfaceBytesReference
- Throws:
java.io.IOException
-
utf8ToString
public java.lang.String utf8ToString()Description copied from interface:BytesReference
Interprets the referenced bytes as UTF8 bytes, returning the resulting string- Specified by:
utf8ToString
in interfaceBytesReference
-
iterator
public org.apache.lucene.util.BytesRefIterator iterator()Description copied from interface:BytesReference
Returns a BytesRefIterator for this BytesReference. This method allows access to the internal pages of this reference without copying them. Use with care!- Specified by:
iterator
in interfaceBytesReference
- See Also:
BytesRefIterator
-
equals
public boolean equals(java.lang.Object other)- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()- Overrides:
hashCode
in classjava.lang.Object
-
compareTo
- Specified by:
compareTo
in interfacejava.lang.Comparable<BytesReference>
-
toXContent
public org.opensearch.common.xcontent.XContentBuilder toXContent(org.opensearch.common.xcontent.XContentBuilder builder, org.opensearch.common.xcontent.ToXContent.Params params) throws java.io.IOException- Specified by:
toXContent
in interfaceorg.opensearch.common.xcontent.ToXContent
- Throws:
java.io.IOException
-