Package org.apache.bookkeeper.bookie
Class BufferedReadChannel
java.lang.Object
org.apache.bookkeeper.bookie.BufferedChannelBase
org.apache.bookkeeper.bookie.BufferedReadChannel
- Direct Known Subclasses:
BufferedChannel
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
FieldsModifier and TypeFieldDescription(package private) long(package private) longprotected final io.netty.buffer.ByteBufprotected longprotected final int(package private) final booleanFields inherited from class org.apache.bookkeeper.bookie.BufferedChannelBase
fileChannel -
Constructor Summary
ConstructorsConstructorDescriptionBufferedReadChannel(FileChannel fileChannel, int readCapacity) BufferedReadChannel(FileChannel fileChannel, int readCapacity, boolean sealed) -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()intread(io.netty.buffer.ByteBuf dest, long pos) Read as many bytes into dest as dest.capacity() starting at position pos in the FileChannel.intread(io.netty.buffer.ByteBuf dest, long pos, int length) longsize()Get the current size of the underlying FileChannel.Methods inherited from class org.apache.bookkeeper.bookie.BufferedChannelBase
validateAndGetFileChannel
-
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
-
BufferedReadChannel
-
-
Method Details
-
read
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
Description copied from class:BufferedChannelBaseGet the current size of the underlying FileChannel.- Overrides:
sizein classBufferedChannelBase- Returns:
- Throws:
IOException
-
read
- Throws:
IOException
-
clear
public void clear()
-