Class FileRegionWriteReadUtils
java.lang.Object
org.apache.flink.runtime.io.network.partition.hybrid.index.FileRegionWriteReadUtils
Utils for read and write
FileDataIndexRegionHelper.Region.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ByteBufferallocateAndConfigureBuffer(int bufferSize) Allocate a buffer with specific size and configure it to native order.readFixedSizeRegionFromFile(FileChannel channel, ByteBuffer regionBuffer, long fileOffset) static voidwriteFixedSizeRegionToFile(FileChannel channel, ByteBuffer regionBuffer, FileDataIndexRegionHelper.Region region)
-
Constructor Details
-
FileRegionWriteReadUtils
public FileRegionWriteReadUtils()
-
-
Method Details
-
allocateAndConfigureBuffer
Allocate a buffer with specific size and configure it to native order.- Parameters:
bufferSize- the size of buffer to allocate.- Returns:
- a native order buffer with expected size.
-
writeFixedSizeRegionToFile
public static void writeFixedSizeRegionToFile(FileChannel channel, ByteBuffer regionBuffer, FileDataIndexRegionHelper.Region region) throws IOException WriteProducerMergedPartitionFileIndex.FixedSizeRegiontoFileChannel.Note that this type of region's length is fixed.
- Parameters:
channel- the file's channel to write.regionBuffer- the buffer to writeProducerMergedPartitionFileIndex.FixedSizeRegion's header.region- the region to be written to channel.- Throws:
IOException
-
readFixedSizeRegionFromFile
public static ProducerMergedPartitionFileIndex.FixedSizeRegion readFixedSizeRegionFromFile(FileChannel channel, ByteBuffer regionBuffer, long fileOffset) throws IOException ReadProducerMergedPartitionFileIndex.FixedSizeRegionfromFileChannel.Note that this type of region's length is fixed.
- Parameters:
channel- the channel to read.regionBuffer- the buffer to readProducerMergedPartitionFileIndex.FixedSizeRegion's header.fileOffset- the file offset to start read.- Returns:
- the
ProducerMergedPartitionFileIndex.FixedSizeRegionthat read from this channel. - Throws:
IOException
-