java.lang.Object
org.apache.bookkeeper.bookie.storage.directentrylogger.DirectReader
All Implemented Interfaces:
AutoCloseable, LogReader

class DirectReader extends Object implements LogReader
  • Constructor Details

  • Method Details

    • logId

      public int logId()
      Specified by:
      logId in interface LogReader
      Returns:
      the id of the log being read from.
    • readBufferAt

      public io.netty.buffer.ByteBuf readBufferAt(long offset, int size) throws IOException, EOFException
      Description copied from interface: LogReader
      Read a buffer from the file. It is the responsibility of the caller to release the returned buffer.
      Specified by:
      readBufferAt in interface LogReader
      Parameters:
      offset - the offset to read at
      size - the number of bytes to read
      Returns:
      a bytebuf. The caller must release.
      Throws:
      IOException
      EOFException
    • readIntoBufferAt

      public void readIntoBufferAt(io.netty.buffer.ByteBuf buffer, long offset, int size) throws IOException, EOFException
      Specified by:
      readIntoBufferAt in interface LogReader
      Throws:
      IOException
      EOFException
    • readIntAt

      public int readIntAt(long offset) throws IOException, EOFException
      Description copied from interface: LogReader
      Read an integer at a given offset.
      Specified by:
      readIntAt in interface LogReader
      Parameters:
      offset - the offset to read from.
      Returns:
      the integer at that offset.
      Throws:
      IOException
      EOFException
    • readLongAt

      public long readLongAt(long offset) throws IOException, EOFException
      Description copied from interface: LogReader
      Read an long at a given offset.
      Specified by:
      readLongAt in interface LogReader
      Parameters:
      offset - the offset to read from.
      Returns:
      the long at that offset.
      Throws:
      IOException
      EOFException
    • readEntryAt

      public io.netty.buffer.ByteBuf readEntryAt(int offset) throws IOException, EOFException
      Description copied from interface: LogReader
      Read an entry at a given offset. The size of the entry must be at (offset - Integer.BYTES). The payload of the entry starts at offset. It is the responsibility of the caller to release the returned buffer.
      Specified by:
      readEntryAt in interface LogReader
      Parameters:
      offset - the offset at which to read the entry.
      Returns:
      a bytebuf. The caller must release.
      Throws:
      IOException
      EOFException
    • readBlock

      void readBlock(long offset) throws IOException
      Throws:
      IOException
    • close

      public void close() throws IOException
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface LogReader
      Throws:
      IOException
    • isClosed

      public boolean isClosed()
      Specified by:
      isClosed in interface LogReader
    • maxOffset

      public long maxOffset()
      Specified by:
      maxOffset in interface LogReader
      Returns:
      the maximum offset in the file that can be read from.