Class BufferedReadChannel

  • Direct Known Subclasses:
    BufferedChannel

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

      • 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 Detail

      • BufferedReadChannel

        public BufferedReadChannel​(java.nio.channels.FileChannel fileChannel,
                                   int readCapacity)
      • BufferedReadChannel

        public BufferedReadChannel​(java.nio.channels.FileChannel fileChannel,
                                   int readCapacity,
                                   boolean sealed)
    • Method Detail

      • read

        public int read​(io.netty.buffer.ByteBuf dest,
                        long pos)
                 throws java.io.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:
        java.io.IOException - if I/O error occurs
      • size

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

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

        public void clear()