Class EntryKeyValue

java.lang.Object
org.apache.bookkeeper.bookie.EntryKey
org.apache.bookkeeper.bookie.EntryKeyValue

public class EntryKeyValue extends EntryKey
An entry Key/Value. EntryKeyValue wraps a byte array and takes offsets and lengths into the array to interpret the content as entry blob.
  • Constructor Details

    • EntryKeyValue

      public EntryKeyValue(long ledgerId, long entryId, byte[] bytes)
      Creates a EntryKeyValue from the start of the specified byte array. Presumes bytes content contains the value portion of a EntryKeyValue.
      Parameters:
      bytes - byte array
    • EntryKeyValue

      public EntryKeyValue(long ledgerId, long entryId, byte[] bytes, int offset, int length)
      Creates a EntryKeyValue from the start of the specified byte array. Presumes bytes content contains the value portion of a EntryKeyValue.
      Parameters:
      bytes - byte array
      offset - offset in bytes as start of blob
      length - of blob
  • Method Details

    • getBuffer

      public byte[] getBuffer()
      Returns:
      The byte array backing this EntryKeyValue.
    • getOffset

      public int getOffset()
      Returns:
      Offset into getBuffer() at which the EntryKeyValue starts.
    • getLength

      public int getLength()
      Returns:
      Length of bytes this EntryKeyValue occupies in getBuffer().
    • getValueAsByteBuffer

      public io.netty.buffer.ByteBuf getValueAsByteBuffer()
      Returns the blob wrapped in a new ByteBuffer.
      Returns:
      the value
    • writeToByteBuffer

      int writeToByteBuffer(ByteBuffer dst)
      Write EntryKeyValue blob into the provided byte buffer.
      Parameters:
      dst - the bytes buffer to use
      Returns:
      The number of useful bytes in the buffer.
      Throws:
      IllegalArgumentException - an illegal value was passed or there is insufficient space remaining in the buffer
    • toString

      public String toString()
      String representation.
      Overrides:
      toString in class Object
    • equals

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

      public int hashCode()
      Overrides:
      hashCode in class EntryKey