@InterfaceAudience.Public @InterfaceStability.Unstable public interface LedgerEntry extends java.lang.AutoCloseable
The entry implementation may hold references to byte buffers under the hood. The users holding the
references to the instances of this class, are responsible for calling close()
to release
resources held by the entry instances.
Modifier and Type | Method and Description |
---|---|
void |
close() |
LedgerEntry |
duplicate()
Returns a duplicate of this 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.
|
long getLedgerId()
long getEntryId()
long getLength()
byte[] getEntryBytes()
java.nio.ByteBuffer getEntryNioBuffer()
ByteBuffer
. The returned buffer
shares the content with this underneath bytebuf (which you can get it by 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.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 close()
, the caller must retain the references of the bytebuf.
LedgerEntry duplicate()
This call will retain a slice of the underneath byte buffer.
void close()
close
in interface java.lang.AutoCloseable
Copyright © 2011–2020 The Apache Software Foundation. All rights reserved.