Package org.apache.flink.runtime.io.disk
Class RandomAccessInputView
- java.lang.Object
-
- org.apache.flink.runtime.memory.AbstractPagedInputView
-
- org.apache.flink.runtime.io.disk.RandomAccessInputView
-
- All Implemented Interfaces:
DataInput
,org.apache.flink.core.memory.DataInputView
,org.apache.flink.core.memory.SeekableDataInputView
public class RandomAccessInputView extends AbstractPagedInputView implements org.apache.flink.core.memory.SeekableDataInputView
-
-
Field Summary
-
Fields inherited from class org.apache.flink.runtime.memory.AbstractPagedInputView
headerLength
-
-
Constructor Summary
Constructors Constructor Description RandomAccessInputView(ArrayList<org.apache.flink.core.memory.MemorySegment> segments, int segmentSize)
RandomAccessInputView(ArrayList<org.apache.flink.core.memory.MemorySegment> segments, int segmentSize, int limitInLastSegment)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected int
getLimitForSegment(org.apache.flink.core.memory.MemorySegment segment)
Gets the limit for reading bytes from the given memory segment.long
getReadPosition()
protected org.apache.flink.core.memory.MemorySegment
nextSegment(org.apache.flink.core.memory.MemorySegment current)
The method by which concrete subclasses realize page crossing.void
setReadPosition(long position)
-
Methods inherited from class org.apache.flink.runtime.memory.AbstractPagedInputView
advance, clear, doAdvance, getCurrentPositionInSegment, getCurrentSegment, getCurrentSegmentLimit, getHeaderLength, read, read, readBoolean, readByte, readChar, readDouble, readFloat, readFully, readFully, readInt, readLine, readLong, readShort, readUnsignedByte, readUnsignedShort, readUTF, seekInput, skipBytes, skipBytesToRead
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.io.DataInput
readBoolean, readByte, readChar, readDouble, readFloat, readFully, readFully, readInt, readLine, readLong, readShort, readUnsignedByte, readUnsignedShort, readUTF, skipBytes
-
-
-
-
Constructor Detail
-
RandomAccessInputView
public RandomAccessInputView(ArrayList<org.apache.flink.core.memory.MemorySegment> segments, int segmentSize)
-
RandomAccessInputView
public RandomAccessInputView(ArrayList<org.apache.flink.core.memory.MemorySegment> segments, int segmentSize, int limitInLastSegment)
-
-
Method Detail
-
setReadPosition
public void setReadPosition(long position)
- Specified by:
setReadPosition
in interfaceorg.apache.flink.core.memory.SeekableDataInputView
-
getReadPosition
public long getReadPosition()
-
nextSegment
protected org.apache.flink.core.memory.MemorySegment nextSegment(org.apache.flink.core.memory.MemorySegment current) throws EOFException
Description copied from class:AbstractPagedInputView
The method by which concrete subclasses realize page crossing. This method is invoked when the current page is exhausted and a new page is required to continue the reading. If no further page is available, this method must throw anEOFException
.- Specified by:
nextSegment
in classAbstractPagedInputView
- Parameters:
current
- The current page that was read to its limit. May benull
, if this method is invoked for the first time.- Returns:
- The next page from which the reading should continue. May not be
null
. If the input is exhausted, anEOFException
must be thrown instead. - Throws:
EOFException
- Thrown, if no further segment is available.
-
getLimitForSegment
protected int getLimitForSegment(org.apache.flink.core.memory.MemorySegment segment)
Description copied from class:AbstractPagedInputView
Gets the limit for reading bytes from the given memory segment. This method must return the position of the byte after the last valid byte in the given memory segment. When the position returned by this method is reached, the view will attempt to switch to the next memory segment.- Specified by:
getLimitForSegment
in classAbstractPagedInputView
- Parameters:
segment
- The segment to determine the limit for.- Returns:
- The limit for the given memory segment.
-
-