Package org.apache.flink.state.forst.fs
Class ByteBufferReadableFSDataInputStream
- java.lang.Object
-
- java.io.InputStream
-
- org.apache.flink.core.fs.FSDataInputStream
-
- org.apache.flink.state.forst.fs.ByteBufferReadableFSDataInputStream
-
- All Implemented Interfaces:
Closeable,AutoCloseable
@Experimental public class ByteBufferReadableFSDataInputStream extends org.apache.flink.core.fs.FSDataInputStreamAFSDataInputStreamdelegates requests to other one and supports reading data withByteBuffer.All methods in this class maybe used by ForSt, please start a discussion firstly if it has to be modified.
-
-
Constructor Summary
Constructors Constructor Description ByteBufferReadableFSDataInputStream(Callable<org.apache.flink.core.fs.FSDataInputStream> inputStreamBuilder, int inputStreamCapacity, long totalFileSize)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intavailable()voidclose()longgetPos()voidmark(int readlimit)booleanmarkSupported()intread()intread(byte[] b)intread(byte[] b, int off, int len)intreadFully(long position, ByteBuffer bb)Reads up toByteBuffer#remainingbytes of data from the specific position of the input stream into a ByteBuffer.intreadFully(ByteBuffer bb)Reads up toByteBuffer#remainingbytes of data from the input stream into a ByteBuffer.voidreset()voidseek(long desired)longskip(long n)-
Methods inherited from class java.io.InputStream
nullInputStream, readAllBytes, readNBytes, readNBytes, transferTo
-
-
-
-
Constructor Detail
-
ByteBufferReadableFSDataInputStream
public ByteBufferReadableFSDataInputStream(Callable<org.apache.flink.core.fs.FSDataInputStream> inputStreamBuilder, int inputStreamCapacity, long totalFileSize) throws IOException
- Throws:
IOException
-
-
Method Detail
-
readFully
public int readFully(ByteBuffer bb) throws IOException
Reads up toByteBuffer#remainingbytes of data from the input stream into a ByteBuffer. Not Thread-safe yet since the interface of sequential read of ForSt only be accessed by one thread at a time. TODO: Rename all methods about 'readFully' to 'read' when next version of ForSt is ready.- Parameters:
bb- the buffer into which the data is read.- Returns:
- the total number of bytes read into the buffer.
- Throws:
IOException- If the first byte cannot be read for any reason other than end of file, or if the input stream has been closed, or if some other I/O error occurs.NullPointerException- Ifbbisnull.
-
readFully
public int readFully(long position, ByteBuffer bb) throws ExceptionReads up toByteBuffer#remainingbytes of data from the specific position of the input stream into a ByteBuffer. Thread-safe since the interface of random read of ForSt may be concurrently accessed by multiple threads. TODO: Support to split this method to other class.- Parameters:
position- the start offset in input stream at which the data is read.bb- the buffer into which the data is read.- Returns:
- the total number of bytes read into the buffer.
- Throws:
IOException- If the first byte cannot be read for any reason other than end of file, or if the input stream has been closed, or if some other I/O error occurs.NullPointerException- Ifbbisnull.Exception
-
seek
public void seek(long desired) throws IOException- Specified by:
seekin classorg.apache.flink.core.fs.FSDataInputStream- Throws:
IOException
-
getPos
public long getPos() throws IOException- Specified by:
getPosin classorg.apache.flink.core.fs.FSDataInputStream- Throws:
IOException
-
read
public int read() throws IOException- Specified by:
readin classInputStream- Throws:
IOException
-
read
public int read(byte[] b) throws IOException- Overrides:
readin classInputStream- Throws:
IOException
-
read
public int read(byte[] b, int off, int len) throws IOException- Overrides:
readin classInputStream- Throws:
IOException
-
skip
public long skip(long n) throws IOException- Overrides:
skipin classInputStream- Throws:
IOException
-
available
public int available() throws IOException- Overrides:
availablein classInputStream- Throws:
IOException
-
close
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classInputStream- Throws:
IOException
-
mark
public void mark(int readlimit)
- Overrides:
markin classInputStream
-
reset
public void reset() throws IOException- Overrides:
resetin classInputStream- Throws:
IOException
-
markSupported
public boolean markSupported()
- Overrides:
markSupportedin classInputStream
-
-