Package org.apache.bookkeeper.bookie
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.
-
-
Field Summary
-
Fields inherited from class org.apache.bookkeeper.bookie.EntryKey
COMPARATOR, entryId, ledgerId
-
-
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.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object other)byte[]getBuffer()intgetLength()intgetOffset()io.netty.buffer.ByteBufgetValueAsByteBuffer()Returns the blob wrapped in a newByteBuffer.inthashCode()java.lang.StringtoString()String representation.(package private) intwriteToByteBuffer(java.nio.ByteBuffer dst)Write EntryKeyValue blob into the provided byte buffer.-
Methods inherited from class org.apache.bookkeeper.bookie.EntryKey
getEntryId, getLedgerId
-
-
-
-
Constructor Detail
-
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 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 newByteBuffer.- 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:
toStringin classjava.lang.Object
-
-