Class RawData

java.lang.Object
com.yahoo.searchlib.aggregation.RawData
All Implemented Interfaces:
Cloneable, Comparable<RawData>

public class RawData extends Object implements 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

    Constructors
    Constructor
    Description
    Constructs an empty data object.
    RawData(byte[] data)
    Constructs a raw data object that holds the given byte array.
  • Method Summary

    Modifier and Type
    Method
    Description
     
    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[]
    Returns the byte array that constitutes this data.
    int
     
    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.
     

    Methods inherited from class java.lang.Object

    finalize, getClass, notify, notifyAll, wait, wait, wait
  • 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

      public RawData setData(byte[] data)
      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

      public int compareTo(RawData rhs)
      Specified by:
      compareTo in interface Comparable<RawData>
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • clone

      public Object clone()
      Overrides:
      clone in class Object
    • compare

      public static int compare(byte[] lhs, byte[] rhs)
      Implements comparison of two byte arrays.
      Parameters:
      lhs - the left-hand-side of the comparison
      rhs - the right-hand-side of the comparison
      Returns:
      the result of comparing the two byte arrays