Package org.apache.bookkeeper.bookie
Class EntryKeyValue
java.lang.Object
org.apache.bookkeeper.bookie.EntryKey
org.apache.bookkeeper.bookie.EntryKeyValue
An entry Key/Value.
EntryKeyValue wraps a byte array and takes offsets and lengths into the array to
interpret the content as entry blob.
-
Field Summary
Fields inherited from class org.apache.bookkeeper.bookie.EntryKey
COMPARATOR, entryId, ledgerId -
Constructor Summary
ConstructorsConstructorDescriptionEntryKeyValue(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. -
Method Summary
Methods inherited from class org.apache.bookkeeper.bookie.EntryKey
getEntryId, getLedgerId
-
Constructor Details
-
EntryKeyValue
public EntryKeyValue(long ledgerId, long entryId, byte[] bytes) Creates a EntryKeyValue from the start of the specified byte array. Presumesbytescontent 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. Presumesbytescontent contains the value portion of a EntryKeyValue.- Parameters:
bytes- byte arrayoffset- offset in bytes as start of bloblength- 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 newByteBuffer.- Returns:
- the value
-
writeToByteBuffer
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
String representation. -
equals
-
hashCode
public int hashCode()
-