Class 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 Summary

      Constructors 
      Constructor Description
      EntryKeyValue​(long ledgerId, long entryId, byte[] bytes)
      Creates a EntryKeyValue from the start of the specified byte array.
      EntryKeyValue​(long ledgerId, long entryId, byte[] bytes, int offset, int length)
      Creates a EntryKeyValue from the start of the specified byte array.
    • Constructor Detail

      • 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 Detail

      • 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​(java.nio.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:
        java.lang.IllegalArgumentException - an illegal value was passed or there is insufficient space remaining in the buffer
      • toString

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

        public boolean equals​(java.lang.Object other)
        Overrides:
        equals in class EntryKey