public class FileRegionWriteReadUtils extends Object
FileDataIndexRegionHelper.Region.| Constructor and Description |
|---|
FileRegionWriteReadUtils() |
| Modifier and Type | Method and Description |
|---|---|
static ByteBuffer |
allocateAndConfigureBuffer(int bufferSize)
Allocate a buffer with specific size and configure it to native order.
|
static ProducerMergedPartitionFileIndex.FixedSizeRegion |
readFixedSizeRegionFromFile(FileChannel channel,
ByteBuffer regionBuffer,
long fileOffset)
|
static HsFileDataIndexImpl.InternalRegion |
readHsInternalRegionFromFile(FileChannel channel,
ByteBuffer headerBuffer,
long fileOffset)
Read
HsFileDataIndexImpl.InternalRegion from FileChannel. |
static void |
writeFixedSizeRegionToFile(FileChannel channel,
ByteBuffer regionBuffer,
FileDataIndexRegionHelper.Region region)
|
static void |
writeHsInternalRegionToFile(FileChannel channel,
ByteBuffer headerBuffer,
HsFileDataIndexImpl.InternalRegion region)
|
public static ByteBuffer allocateAndConfigureBuffer(int bufferSize)
bufferSize - the size of buffer to allocate.public static void writeHsInternalRegionToFile(FileChannel channel, ByteBuffer headerBuffer, HsFileDataIndexImpl.InternalRegion region) throws IOException
HsFileDataIndexImpl.InternalRegion to FileChannel.
Note that this type of region's length may be variable because it contains an array to indicate each buffer's release state.
channel - the file's channel to write.headerBuffer - the buffer to write HsFileDataIndexImpl.InternalRegion's header.region - the region to be written to channel.IOExceptionpublic static HsFileDataIndexImpl.InternalRegion readHsInternalRegionFromFile(FileChannel channel, ByteBuffer headerBuffer, long fileOffset) throws IOException
HsFileDataIndexImpl.InternalRegion from FileChannel.
Note that this type of region's length may be variable because it contains an array to indicate each buffer's release state.
channel - the channel to read.headerBuffer - the buffer to read HsFileDataIndexImpl.InternalRegion's header.fileOffset - the file offset to start read.HsFileDataIndexImpl.InternalRegion that read from this channel.IOExceptionpublic static void writeFixedSizeRegionToFile(FileChannel channel, ByteBuffer regionBuffer, FileDataIndexRegionHelper.Region region) throws IOException
ProducerMergedPartitionFileIndex.FixedSizeRegion to FileChannel.
Note that this type of region's length is fixed.
channel - the file's channel to write.regionBuffer - the buffer to write ProducerMergedPartitionFileIndex.FixedSizeRegion's header.region - the region to be written to channel.IOExceptionpublic static ProducerMergedPartitionFileIndex.FixedSizeRegion readFixedSizeRegionFromFile(FileChannel channel, ByteBuffer regionBuffer, long fileOffset) throws IOException
ProducerMergedPartitionFileIndex.FixedSizeRegion from FileChannel.
Note that this type of region's length is fixed.
channel - the channel to read.regionBuffer - the buffer to read ProducerMergedPartitionFileIndex.FixedSizeRegion's header.fileOffset - the file offset to start read.ProducerMergedPartitionFileIndex.FixedSizeRegion that read from this channel.IOExceptionCopyright © 2014–2025 The Apache Software Foundation. All rights reserved.