Package com.yahoo.searchlib.aggregation
Class RawData
java.lang.Object
com.yahoo.searchlib.aggregation.RawData
- All Implemented Interfaces:
Cloneable
,Comparable<RawData>
A byte array a a cloneable and comparable object. It also implements a sane
hashCode()
and toString()
.- Author:
- Simon Thoresen Hult
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionclone()
static int
compare
(byte[] lhs, byte[] rhs) Implements comparison of two byte arrays.int
void
deserialize
(com.yahoo.vespa.objects.Deserializer buf) Deserializes the content for this data from the given byte buffer.boolean
byte[]
getData()
Returns the byte array that constitutes this data.int
hashCode()
void
serialize
(com.yahoo.vespa.objects.Serializer buf) Serializes the content of this data into the given byte buffer.setData
(byte[] data) Sets the byte array that constitutes this data.toString()
-
Constructor Details
-
RawData
public RawData()Constructs an empty data object. -
RawData
public RawData(byte[] data) Constructs a raw data object that holds the given byte array.- Parameters:
data
- the rank to set
-
-
Method Details
-
serialize
public void serialize(com.yahoo.vespa.objects.Serializer buf) Serializes the content of this data into the given byte buffer.- Parameters:
buf
- the buffer to serialize to
-
deserialize
public void deserialize(com.yahoo.vespa.objects.Deserializer buf) Deserializes the content for this data from the given byte buffer.- Parameters:
buf
- the buffer to deserialize from
-
getData
public byte[] getData()Returns the byte array that constitutes this data.- Returns:
- the byte array
-
setData
Sets the byte array that constitutes this data. This does not copy the given array, it simply assigns it to this.- Parameters:
data
- the data to set- Returns:
- this, to allow chaining
-
compareTo
- Specified by:
compareTo
in interfaceComparable<RawData>
-
equals
-
hashCode
public int hashCode() -
toString
-
clone
-
compare
public static int compare(byte[] lhs, byte[] rhs) Implements comparison of two byte arrays.- Parameters:
lhs
- the left-hand-side of the comparisonrhs
- the right-hand-side of the comparison- Returns:
- the result of comparing the two byte arrays
-