Package org.openhab.core.cache.lru
Class InputStreamCacheWrapper
java.lang.Object
java.io.InputStream
org.openhab.core.cache.lru.InputStreamCacheWrapper
- All Implemented Interfaces:
Closeable
,AutoCloseable
Each cache result instance can handle several
InputStream
s.
This class is a wrapper for such functionality and can
ask the cached entry for data, allowing concurrent access to
the source even if it is currently actively read from the supplier service.
This class implements the two main read methods (byte by byte, and with an array)- Author:
- Gwendal Roulleau - Initial contribution
-
Constructor Summary
ConstructorDescriptionInputStreamCacheWrapper
(LRUMediaCacheEntry<?> cacheEntry) Construct a transparent InputStream wrapper around data from the cache. -
Method Summary
Methods inherited from class java.io.InputStream
nullInputStream, read, readAllBytes, readNBytes, readNBytes, skipNBytes, transferTo
-
Constructor Details
-
InputStreamCacheWrapper
Construct a transparent InputStream wrapper around data from the cache.- Parameters:
cacheEntry
- The parent cachedLRUMediaCacheEntry
-
-
Method Details
-
available
- Overrides:
available
in classInputStream
- Throws:
IOException
-
read
- Specified by:
read
in classInputStream
- Throws:
IOException
-
read
- Overrides:
read
in classInputStream
- Throws:
IOException
-
skip
- Overrides:
skip
in classInputStream
- Throws:
IOException
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classInputStream
- Throws:
IOException
-
length
public long length() -
getClonedStream
- Throws:
IOException
-
mark
public void mark(int readlimit) - Overrides:
mark
in classInputStream
-
reset
- Overrides:
reset
in classInputStream
- Throws:
IOException
-
markSupported
public boolean markSupported()- Overrides:
markSupported
in classInputStream
-