Package org.apache.flink.runtime.io.disk
Class SpillingBuffer
- java.lang.Object
-
- org.apache.flink.runtime.memory.AbstractPagedOutputView
-
- org.apache.flink.runtime.io.disk.SpillingBuffer
-
- All Implemented Interfaces:
DataOutput
,org.apache.flink.core.memory.DataOutputView
,org.apache.flink.core.memory.MemorySegmentWritable
public class SpillingBuffer extends AbstractPagedOutputView
An output view that buffers written data in memory pages and spills them when they are full.
-
-
Field Summary
-
Fields inherited from class org.apache.flink.runtime.memory.AbstractPagedOutputView
headerLength, segmentSize
-
-
Constructor Summary
Constructors Constructor Description SpillingBuffer(IOManager ioManager, org.apache.flink.core.memory.MemorySegmentSource memSource, int segmentSize)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<org.apache.flink.core.memory.MemorySegment>
close()
org.apache.flink.core.memory.DataInputView
flip()
protected org.apache.flink.core.memory.MemorySegment
nextSegment(org.apache.flink.core.memory.MemorySegment current, int positionInCurrent)
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
-
SpillingBuffer
public SpillingBuffer(IOManager ioManager, org.apache.flink.core.memory.MemorySegmentSource memSource, int segmentSize)
-
-
Method Detail
-
nextSegment
protected org.apache.flink.core.memory.MemorySegment nextSegment(org.apache.flink.core.memory.MemorySegment current, int positionInCurrent) 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 segmentpositionInCurrent
- The position in the segment, one after the last valid byte.- Returns:
- The next memory segment.
- Throws:
IOException
-
flip
public org.apache.flink.core.memory.DataInputView flip() throws IOException
- Throws:
IOException
-
close
public List<org.apache.flink.core.memory.MemorySegment> close() throws IOException
- Returns:
- A list with all memory segments that have been taken from the memory segment source.
- Throws:
IOException
-
-