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,org.apache.flink.core.memory.DataOutputView,org.apache.flink.core.memory.MemorySegmentWritable
A
DataOutputView that is backed by a BlockChannelWriter, 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
ConstructorsConstructorDescriptionFileChannelOutputView(BlockChannelWriter<org.apache.flink.core.memory.MemorySegment> writer, MemoryManager memManager, List<org.apache.flink.core.memory.MemorySegment> memory, int segmentSize) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes this output, writing pending data and releasing the memory.voidCloses this output, writing pending data and releasing the memory.intGets the number of blocks written by this output view.intGets the number of bytes written in the latest memory segment.longprotected org.apache.flink.core.memory.MemorySegmentnextSegment(org.apache.flink.core.memory.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 Details
-
FileChannelOutputView
public FileChannelOutputView(BlockChannelWriter<org.apache.flink.core.memory.MemorySegment> writer, MemoryManager memManager, List<org.apache.flink.core.memory.MemorySegment> memory, int segmentSize) throws IOException - Throws:
IOException
-
-
Method Details
-
close
Closes this output, writing pending data and releasing the memory.- Throws:
IOException- Thrown, if the pending data could not be written.
-
closeAndDelete
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 org.apache.flink.core.memory.MemorySegment nextSegment(org.apache.flink.core.memory.MemorySegment current, int posInSegment) throws IOException Description copied from class:AbstractPagedOutputViewThis method must return a segment. If no more segments are available, it must throw anEOFException.- Specified by:
nextSegmentin 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
-