Class BufferedReadChannel

java.lang.Object
org.apache.bookkeeper.bookie.BufferedChannelBase
org.apache.bookkeeper.bookie.BufferedReadChannel
Direct Known Subclasses:
BufferedChannel

public class BufferedReadChannel extends BufferedChannelBase
A Buffered channel without a write buffer. Only reads are buffered.
  • Field Details

    • readCapacity

      protected final int readCapacity
    • readBuffer

      protected final io.netty.buffer.ByteBuf readBuffer
    • readBufferStartPosition

      protected long readBufferStartPosition
    • invocationCount

      long invocationCount
    • cacheHitCount

      long cacheHitCount
    • sealed

      final boolean sealed
  • Constructor Details

    • BufferedReadChannel

      public BufferedReadChannel(FileChannel fileChannel, int readCapacity)
    • BufferedReadChannel

      public BufferedReadChannel(FileChannel fileChannel, int readCapacity, boolean sealed)
  • Method Details

    • read

      public int read(io.netty.buffer.ByteBuf dest, long pos) throws IOException
      Read as many bytes into dest as dest.capacity() starting at position pos in the FileChannel. This function can read from the buffer or the file channel depending on the implementation..
      Parameters:
      dest -
      pos -
      Returns:
      The total number of bytes read. -1 if the given position is greater than or equal to the file's current size.
      Throws:
      IOException - if I/O error occurs
    • size

      public long size() throws IOException
      Description copied from class: BufferedChannelBase
      Get the current size of the underlying FileChannel.
      Overrides:
      size in class BufferedChannelBase
      Returns:
      Throws:
      IOException
    • read

      public int read(io.netty.buffer.ByteBuf dest, long pos, int length) throws IOException
      Throws:
      IOException
    • clear

      public void clear()