Class FileRegionWriteReadUtils
- java.lang.Object
-
- org.apache.flink.runtime.io.network.partition.hybrid.index.FileRegionWriteReadUtils
-
public class FileRegionWriteReadUtils extends Object
Utils for read and writeFileDataIndexRegionHelper.Region.
-
-
Constructor Summary
Constructors Constructor Description FileRegionWriteReadUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static ByteBufferallocateAndConfigureBuffer(int bufferSize)Allocate a buffer with specific size and configure it to native order.static ProducerMergedPartitionFileIndex.FixedSizeRegionreadFixedSizeRegionFromFile(FileChannel channel, ByteBuffer regionBuffer, long fileOffset)static voidwriteFixedSizeRegionToFile(FileChannel channel, ByteBuffer regionBuffer, FileDataIndexRegionHelper.Region region)
-
-
-
Method Detail
-
allocateAndConfigureBuffer
public static ByteBuffer allocateAndConfigureBuffer(int bufferSize)
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
-
-