public final class BufferReaderWriterUtil extends Object
The encoding is the same across FileChannel and ByteBuffer, so this class can write to a file and read from the byte buffer that results from mapping this file to memory.
| 限定符和类型 | 字段和说明 |
|---|---|
static int |
HEADER_LENGTH |
| 构造器和说明 |
|---|
BufferReaderWriterUtil() |
| 限定符和类型 | 方法和说明 |
|---|---|
static ByteBuffer |
allocatedHeaderBuffer() |
static void |
positionToNextBuffer(FileChannel channel,
ByteBuffer headerBuffer)
Skip one data buffer from the channel's current position by headerBuffer.
|
static void |
readByteBufferFully(FileChannel channel,
ByteBuffer b,
long position) |
static Buffer |
readFromByteChannel(FileChannel channel,
ByteBuffer headerBuffer,
org.apache.flink.core.memory.MemorySegment memorySegment,
BufferRecycler bufferRecycler) |
static void |
setByteChannelBufferHeader(Buffer buffer,
ByteBuffer header) |
static void |
writeBuffers(FileChannel channel,
long bytesExpected,
ByteBuffer... buffers) |
public static final int HEADER_LENGTH
public static void setByteChannelBufferHeader(Buffer buffer, ByteBuffer header)
@Nullable public static Buffer readFromByteChannel(FileChannel channel, ByteBuffer headerBuffer, org.apache.flink.core.memory.MemorySegment memorySegment, BufferRecycler bufferRecycler) throws IOException
IOExceptionpublic static ByteBuffer allocatedHeaderBuffer()
public static void positionToNextBuffer(FileChannel channel, ByteBuffer headerBuffer) throws IOException
IOExceptionpublic static void readByteBufferFully(FileChannel channel, ByteBuffer b, long position) throws IOException
IOExceptionpublic static void writeBuffers(FileChannel channel, long bytesExpected, ByteBuffer... buffers) throws IOException
IOExceptionCopyright © 2014–2022 The Apache Software Foundation. All rights reserved.