Package org.apache.flink.core.memory
Interface DataInputView
-
- All Superinterfaces:
DataInput
- All Known Subinterfaces:
SeekableDataInputView
- All Known Implementing Classes:
DataInputDeserializer,DataInputViewStreamWrapper
@Public public interface DataInputView extends DataInput
This interface defines a view over some memory that can be used to sequentially read the contents of the memory. The view is typically backed by one or moreMemorySegment.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description intread(byte[] b)Tries to fill the given byte arrayb.intread(byte[] b, int off, int len)Reads up tolenbytes of memory and stores it intobstarting at offsetoff.voidskipBytesToRead(int numBytes)SkipsnumBytesbytes of memory.-
Methods inherited from interface java.io.DataInput
readBoolean, readByte, readChar, readDouble, readFloat, readFully, readFully, readInt, readLine, readLong, readShort, readUnsignedByte, readUnsignedShort, readUTF, skipBytes
-
-
-
-
Method Detail
-
skipBytesToRead
void skipBytesToRead(int numBytes) throws IOExceptionSkipsnumBytesbytes of memory. In contrast to theDataInput.skipBytes(int)method, this method always skips the desired number of bytes or throws anEOFException.- Parameters:
numBytes- The number of bytes to skip.- Throws:
IOException- Thrown, if any I/O related problem occurred such that the input could not be advanced to the desired position.
-
read
int read(byte[] b, int off, int len) throws IOExceptionReads up tolenbytes of memory and stores it intobstarting at offsetoff.If
lenis zero, then no bytes are read and0is returned; otherwise, there is an attempt to read at least one byte. If there is no more data left, the value-1is returned; otherwise, at least one byte is read and stored intob.- Parameters:
b- byte array to store the data tooff- offset into byte arraylen- byte length to read- Returns:
- the number of actually read bytes of -1 if there is no more data left
- Throws:
IOException
-
read
int read(byte[] b) throws IOException
Tries to fill the given byte arrayb. Returns the actually number of read bytes or -1 if there is no more data.- Parameters:
b- byte array to store the data to- Returns:
- the number of read bytes or -1 if there is no more data left
- Throws:
IOException
-
-