Class LedgerEntry

java.lang.Object
org.apache.bookkeeper.client.LedgerEntry

public class LedgerEntry extends Object
Ledger entry. Its a simple tuple containing the ledger id, the entry-id, and the entry content.
  • Field Details

    • ledgerId

      final long ledgerId
    • entryId

      final long entryId
    • length

      final long length
    • data

      io.netty.buffer.ByteBuf data
  • Constructor Details

  • Method Details

    • getLedgerId

      public long getLedgerId()
    • getEntryId

      public long getEntryId()
    • getLength

      public long getLength()
    • getEntry

      public byte[] getEntry()
      Returns the content of the entry. This method can be called only once. While using v2 wire protocol this method will automatically release the internal ByteBuf
      Returns:
      the content of the entry
      Throws:
      IllegalStateException - if this method is called twice
    • getEntryInputStream

      public InputStream getEntryInputStream()
      Returns the content of the entry. This method can be called only once. While using v2 wire protocol this method will automatically release the internal ByteBuf when calling the close method of the returned InputStream
      Returns:
      an InputStream which gives access to the content of the entry
      Throws:
      IllegalStateException - if this method is called twice
    • getEntryBuffer

      public io.netty.buffer.ByteBuf getEntryBuffer()
      Return the internal buffer that contains the entry payload.

      Note: Using v2 wire protocol it is responsibility of the caller to ensure to release the buffer after usage.

      Returns:
      a ByteBuf which contains the data
      Throws:
      IllegalStateException - if the entry has been retrieved by getEntry() or getEntryInputStream().
      See Also: