Package org.elasticsearch.common.bytes
Class AbstractBytesReference
java.lang.Object
org.elasticsearch.common.bytes.AbstractBytesReference
- All Implemented Interfaces:
java.lang.Comparable<BytesReference>,BytesReference,ToXContent,ToXContentFragment
- Direct Known Subclasses:
ByteBufferReference,BytesArray,CompositeBytesReference,PagedBytesReference
public abstract class AbstractBytesReference extends java.lang.Object implements BytesReference
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.elasticsearch.common.xcontent.ToXContent
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.Params -
Field Summary
-
Constructor Summary
Constructors Constructor Description AbstractBytesReference() -
Method Summary
Modifier and Type Method Description intcompareTo(BytesReference other)booleanequals(java.lang.Object other)intgetInt(int index)Returns the integer read from the 4 bytes (BE) starting at the given index.inthashCode()intindexOf(byte marker, int from)Finds the index of the first occurrence of the given marker between within the given bounds.org.apache.lucene.util.BytesRefIteratoriterator()Returns a BytesRefIterator for this BytesReference.StreamInputstreamInput()A stream input of the bytes.XContentBuildertoXContent(XContentBuilder builder, ToXContent.Params params)java.lang.Stringutf8ToString()Interprets the referenced bytes as UTF8 bytes, returning the resulting stringvoidwriteTo(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, waitMethods inherited from interface org.elasticsearch.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:BytesReferenceReturns the integer read from the 4 bytes (BE) starting at the given index.- Specified by:
getIntin interfaceBytesReference
-
indexOf
public int indexOf(byte marker, int from)Description copied from interface:BytesReferenceFinds the index of the first occurrence of the given marker between within the given bounds.- Specified by:
indexOfin interfaceBytesReference- Parameters:
marker- marker byte to searchfrom- lower bound for the index to check (inclusive)- Returns:
- first index of the marker or
-1if not found
-
streamInput
Description copied from interface:BytesReferenceA stream input of the bytes.- Specified by:
streamInputin interfaceBytesReference- Throws:
java.io.IOException
-
writeTo
public void writeTo(java.io.OutputStream os) throws java.io.IOExceptionDescription copied from interface:BytesReferenceWrites the bytes directly to the output stream.- Specified by:
writeToin interfaceBytesReference- Throws:
java.io.IOException
-
utf8ToString
public java.lang.String utf8ToString()Description copied from interface:BytesReferenceInterprets the referenced bytes as UTF8 bytes, returning the resulting string- Specified by:
utf8ToStringin interfaceBytesReference
-
iterator
public org.apache.lucene.util.BytesRefIterator iterator()Description copied from interface:BytesReferenceReturns a BytesRefIterator for this BytesReference. This method allows access to the internal pages of this reference without copying them. Use with care!- Specified by:
iteratorin interfaceBytesReference- See Also:
BytesRefIterator
-
equals
public boolean equals(java.lang.Object other)- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()- Overrides:
hashCodein classjava.lang.Object
-
compareTo
- Specified by:
compareToin interfacejava.lang.Comparable<BytesReference>
-
toXContent
public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws java.io.IOException- Specified by:
toXContentin interfaceToXContent- Throws:
java.io.IOException
-