Class CachedDataInputStream
java.lang.Object
java.io.InputStream
org.apache.flink.core.fs.FSDataInputStream
org.apache.flink.state.forst.fs.cache.CachedDataInputStream
- All Implemented Interfaces:
Closeable,AutoCloseable,org.apache.flink.core.fs.ByteBufferReadable
public class CachedDataInputStream
extends org.apache.flink.core.fs.FSDataInputStream
implements org.apache.flink.core.fs.ByteBufferReadable
A
FSDataInputStream delegates requests to other one and supports reading data with ByteBuffer. One CachedDataInputStream only supports one thread reading which is guaranteed by
ByteBufferReadableFSDataInputStream. The cached input stream might be closed by eviction by other
thread, and the concurrency between reading and evicting is controlled by the reference count of
the cache entry.-
Constructor Summary
ConstructorsConstructorDescriptionCachedDataInputStream(FileBasedCache fileBasedCache, FileCacheEntry cacheEntry, org.apache.flink.core.fs.FSDataInputStream originalStream) CachedDataInputStream(FileBasedCache fileBasedCache, FileCacheEntry cacheEntry, org.apache.flink.core.fs.FSDataInputStream cacheStream, org.apache.flink.core.fs.FSDataInputStream originalStream) -
Method Summary
Modifier and TypeMethodDescriptionintvoidclose()longgetPos()booleanisClosed()voidmark(int readlimit) booleanintread()intread(byte[] b) intread(byte[] b, int off, int len) intread(long position, ByteBuffer bb) intread(ByteBuffer bb) voidreset()voidseek(long desired) longskip(long n) Methods inherited from class java.io.InputStream
nullInputStream, readAllBytes, readNBytes, readNBytes, transferTo
-
Constructor Details
-
CachedDataInputStream
public CachedDataInputStream(FileBasedCache fileBasedCache, FileCacheEntry cacheEntry, org.apache.flink.core.fs.FSDataInputStream cacheStream, org.apache.flink.core.fs.FSDataInputStream originalStream) -
CachedDataInputStream
public CachedDataInputStream(FileBasedCache fileBasedCache, FileCacheEntry cacheEntry, org.apache.flink.core.fs.FSDataInputStream originalStream)
-
-
Method Details
-
seek
- Specified by:
seekin classorg.apache.flink.core.fs.FSDataInputStream- Throws:
IOException
-
getPos
- Specified by:
getPosin classorg.apache.flink.core.fs.FSDataInputStream- Throws:
IOException
-
read
- Specified by:
readin classInputStream- Throws:
IOException
-
read
- Overrides:
readin classInputStream- Throws:
IOException
-
read
- Overrides:
readin classInputStream- Throws:
IOException
-
skip
- Overrides:
skipin classInputStream- Throws:
IOException
-
available
- Overrides:
availablein classInputStream- Throws:
IOException
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classInputStream- Throws:
IOException
-
isClosed
public boolean isClosed() -
mark
public void mark(int readlimit) - Overrides:
markin classInputStream
-
reset
- Overrides:
resetin classInputStream- Throws:
IOException
-
markSupported
public boolean markSupported()- Overrides:
markSupportedin classInputStream
-
read
- Specified by:
readin interfaceorg.apache.flink.core.fs.ByteBufferReadable- Throws:
IOException
-
read
- Specified by:
readin interfaceorg.apache.flink.core.fs.ByteBufferReadable- Throws:
IOException
-