public class LedgerEntryImpl extends java.lang.Object implements LedgerEntry
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
static LedgerEntryImpl |
create(long ledgerId,
long entryId) |
static LedgerEntryImpl |
create(long ledgerId,
long entryId,
long length,
io.netty.buffer.ByteBuf buf) |
LedgerEntryImpl |
duplicate()
Returns a duplicate of this entry.
|
static LedgerEntryImpl |
duplicate(LedgerEntry entry) |
io.netty.buffer.ByteBuf |
getEntryBuffer()
Return the internal
ByteBuf that contains the entry payload. |
byte[] |
getEntryBytes()
Returns the content of the entry as a byte array.
|
long |
getEntryId()
The id of the entry.
|
java.nio.ByteBuffer |
getEntryNioBuffer()
Exposes this entry's data as an NIO
ByteBuffer. |
long |
getLedgerId()
The id of the ledger which contains the entry.
|
long |
getLength()
The length of the entry, that is the size of the content expressed in bytes.
|
void |
setEntryBuf(io.netty.buffer.ByteBuf buf) |
void |
setEntryId(long entryId) |
void |
setLength(long length) |
public static LedgerEntryImpl create(long ledgerId, long entryId)
public static LedgerEntryImpl create(long ledgerId, long entryId, long length, io.netty.buffer.ByteBuf buf)
public static LedgerEntryImpl duplicate(LedgerEntry entry)
public void setEntryId(long entryId)
public void setLength(long length)
public void setEntryBuf(io.netty.buffer.ByteBuf buf)
public long getLedgerId()
getLedgerId in interface LedgerEntrypublic long getEntryId()
getEntryId in interface LedgerEntrypublic long getLength()
getLength in interface LedgerEntrypublic byte[] getEntryBytes()
getEntryBytes in interface LedgerEntrypublic io.netty.buffer.ByteBuf getEntryBuffer()
ByteBuf that contains the entry payload.
This call doesn't change the reference count on the returned bytebuf. If you want to use the bytebuf
after the entry is released (via LedgerEntry.close(), the caller must retain the references of the bytebuf.
getEntryBuffer in interface LedgerEntrypublic java.nio.ByteBuffer getEntryNioBuffer()
ByteBuffer. The returned buffer
shares the content with this underneath bytebuf (which you can get it by LedgerEntry.getEntryBuffer()).
Changing the position and limit of the returned NIO buffer does not affect the indexes and
marks of this underneath buffer. This method is identical
to entry.getEntryBuffer().nioBuffer(). This method does not
modify readerIndex or writerIndex of the underlying bytebuf.getEntryNioBuffer in interface LedgerEntrypublic LedgerEntryImpl duplicate()
This call will retain a slice of the underneath byte buffer.
duplicate in interface LedgerEntrypublic void close()
close in interface java.lang.AutoCloseableclose in interface LedgerEntryCopyright © 2011–2024 The Apache Software Foundation. All rights reserved.