Package org.apache.bookkeeper.bookie
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.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.bookkeeper.bookie.BufferedChannelBase
BufferedChannelBase.BufferedChannelClosedException
-
-
Field Summary
Fields Modifier and Type Field Description (package private) long
cacheHitCount
(package private) long
invocationCount
protected io.netty.buffer.ByteBuf
readBuffer
protected long
readBufferStartPosition
protected int
readCapacity
(package private) boolean
sealed
-
Fields inherited from class org.apache.bookkeeper.bookie.BufferedChannelBase
fileChannel
-
-
Constructor Summary
Constructors Constructor Description BufferedReadChannel(java.nio.channels.FileChannel fileChannel, int readCapacity)
BufferedReadChannel(java.nio.channels.FileChannel fileChannel, int readCapacity, boolean sealed)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear()
int
read(io.netty.buffer.ByteBuf dest, long pos)
Read as many bytes into dest as dest.capacity() starting at position pos in the FileChannel.int
read(io.netty.buffer.ByteBuf dest, long pos, int length)
long
size()
Get the current size of the underlying FileChannel.-
Methods inherited from class org.apache.bookkeeper.bookie.BufferedChannelBase
validateAndGetFileChannel
-
-
-
-
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 classBufferedChannelBase
- 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()
-
-