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
public class FileChannelOutputView extends AbstractPagedOutputView
ADataOutputViewthat 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<org.apache.flink.core.memory.MemorySegment> writer, MemoryManager memManager, List<org.apache.flink.core.memory.MemorySegment> memory, int segmentSize)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Closes this output, writing pending data and releasing the memory.voidcloseAndDelete()Closes this output, writing pending data and releasing the memory.intgetBlockCount()Gets the number of blocks written by this output view.intgetBytesInLatestSegment()Gets the number of bytes written in the latest memory segment.longgetWriteOffset()protected 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 Detail
-
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 Detail
-
close
public void close() throws IOExceptionCloses 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 IOExceptionCloses 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 IOExceptionDescription 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
-
-