Package org.apache.flink.runtime.io.disk
Class FileChannelOutputView
- java.lang.Object
-
- org.apache.flink.runtime.memory.AbstractPagedOutputView
-
- org.apache.flink.runtime.io.disk.FileChannelOutputView
-
- All Implemented Interfaces:
DataOutput
,DataOutputView
,MemorySegmentWritable
public class FileChannelOutputView extends AbstractPagedOutputView
ADataOutputView
that is backed by aBlockChannelWriter
, making it effectively a data output stream. The view writes it data in blocks to the underlying channel.
-
-
Field Summary
-
Fields inherited from class org.apache.flink.runtime.memory.AbstractPagedOutputView
headerLength, segmentSize
-
-
Constructor Summary
Constructors Constructor Description FileChannelOutputView(BlockChannelWriter<MemorySegment> writer, MemoryManager memManager, List<MemorySegment> memory, int segmentSize)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Closes this output, writing pending data and releasing the memory.void
closeAndDelete()
Closes this output, writing pending data and releasing the memory.int
getBlockCount()
Gets the number of blocks written by this output view.int
getBytesInLatestSegment()
Gets the number of bytes written in the latest memory segment.long
getWriteOffset()
protected MemorySegment
nextSegment(MemorySegment current, int posInSegment)
This method must return a segment.-
Methods inherited from class org.apache.flink.runtime.memory.AbstractPagedOutputView
advance, clear, getCurrentPositionInSegment, getCurrentSegment, getHeaderLength, getSegmentSize, seekOutput, skipBytesToWrite, write, write, write, write, write, writeBoolean, writeByte, writeBytes, writeChar, writeChars, writeDouble, writeFloat, writeInt, writeLong, writeShort, writeUTF
-
-
-
-
Constructor Detail
-
FileChannelOutputView
public FileChannelOutputView(BlockChannelWriter<MemorySegment> writer, MemoryManager memManager, List<MemorySegment> memory, int segmentSize) throws IOException
- Throws:
IOException
-
-
Method Detail
-
close
public void close() throws IOException
Closes this output, writing pending data and releasing the memory.- Throws:
IOException
- Thrown, if the pending data could not be written.
-
closeAndDelete
public void closeAndDelete() throws IOException
Closes this output, writing pending data and releasing the memory.- Throws:
IOException
- Thrown, if the pending data could not be written.
-
getBlockCount
public int getBlockCount()
Gets the number of blocks written by this output view.- Returns:
- The number of blocks written by this output view.
-
getBytesInLatestSegment
public int getBytesInLatestSegment()
Gets the number of bytes written in the latest memory segment.- Returns:
- The number of bytes written in the latest memory segment.
-
getWriteOffset
public long getWriteOffset()
-
nextSegment
protected MemorySegment nextSegment(MemorySegment current, int posInSegment) throws IOException
Description copied from class:AbstractPagedOutputView
This method must return a segment. If no more segments are available, it must throw anEOFException
.- Specified by:
nextSegment
in classAbstractPagedOutputView
- Parameters:
current
- The current memory segmentposInSegment
- The position in the segment, one after the last valid byte.- Returns:
- The next memory segment.
- Throws:
IOException
-
-