Class DirectReader
- java.lang.Object
-
- org.apache.bookkeeper.bookie.storage.directentrylogger.DirectReader
-
-
Constructor Summary
Constructors Constructor Description DirectReader(int logId, java.lang.String filename, io.netty.buffer.ByteBufAllocator allocator, NativeIO nativeIO, int bufferSize, int maxSaneEntrySize, OpStatsLogger readBlockStats)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()booleanisClosed()intlogId()longmaxOffset()(package private) voidreadBlock(long offset)io.netty.buffer.ByteBufreadBufferAt(long offset, int size)Read a buffer from the file.io.netty.buffer.ByteBufreadEntryAt(int offset)Read an entry at a given offset.intreadIntAt(long offset)Read an integer at a given offset.voidreadIntoBufferAt(io.netty.buffer.ByteBuf buffer, long offset, int size)longreadLongAt(long offset)Read an long at a given offset.
-
-
-
Constructor Detail
-
DirectReader
DirectReader(int logId, java.lang.String filename, io.netty.buffer.ByteBufAllocator allocator, NativeIO nativeIO, int bufferSize, int maxSaneEntrySize, OpStatsLogger readBlockStats) throws java.io.IOException- Throws:
java.io.IOException
-
-
Method Detail
-
logId
public int logId()
-
readBufferAt
public io.netty.buffer.ByteBuf readBufferAt(long offset, int size) throws java.io.IOException, java.io.EOFExceptionDescription copied from interface:LogReaderRead a buffer from the file. It is the responsibility of the caller to release the returned buffer.- Specified by:
readBufferAtin interfaceLogReader- Parameters:
offset- the offset to read atsize- the number of bytes to read- Returns:
- a bytebuf. The caller must release.
- Throws:
java.io.IOExceptionjava.io.EOFException
-
readIntoBufferAt
public void readIntoBufferAt(io.netty.buffer.ByteBuf buffer, long offset, int size) throws java.io.IOException, java.io.EOFException- Specified by:
readIntoBufferAtin interfaceLogReader- Throws:
java.io.IOExceptionjava.io.EOFException
-
readIntAt
public int readIntAt(long offset) throws java.io.IOException, java.io.EOFExceptionDescription copied from interface:LogReaderRead an integer at a given offset.
-
readLongAt
public long readLongAt(long offset) throws java.io.IOException, java.io.EOFExceptionDescription copied from interface:LogReaderRead an long at a given offset.- Specified by:
readLongAtin interfaceLogReader- Parameters:
offset- the offset to read from.- Returns:
- the long at that offset.
- Throws:
java.io.IOExceptionjava.io.EOFException
-
readEntryAt
public io.netty.buffer.ByteBuf readEntryAt(int offset) throws java.io.IOException, java.io.EOFExceptionDescription copied from interface:LogReaderRead 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:
readEntryAtin interfaceLogReader- Parameters:
offset- the offset at which to read the entry.- Returns:
- a bytebuf. The caller must release.
- Throws:
java.io.IOExceptionjava.io.EOFException
-
readBlock
void readBlock(long offset) throws java.io.IOException- Throws:
java.io.IOException
-
close
public void close() throws java.io.IOException
-
-