Package com.twelvemonkeys.io
Class MemoryCacheSeekableStream
java.lang.Object
java.io.InputStream
com.twelvemonkeys.io.SeekableInputStream
com.twelvemonkeys.io.AbstractCachedSeekableStream
com.twelvemonkeys.io.MemoryCacheSeekableStream
- All Implemented Interfaces:
Seekable
,Closeable
,AutoCloseable
A
SeekableInputStream
implementation that caches data in memory.- Version:
- $Id: //depot/branches/personal/haraldk/twelvemonkeys/release-2/twelvemonkeys-core/src/main/java/com/twelvemonkeys/io/MemoryCacheSeekableStream.java#3 $
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static final class
Nested classes/interfaces inherited from class com.twelvemonkeys.io.AbstractCachedSeekableStream
AbstractCachedSeekableStream.StreamCache
-
Field Summary
Fields inherited from class com.twelvemonkeys.io.AbstractCachedSeekableStream
stream, streamPosition
Fields inherited from class com.twelvemonkeys.io.SeekableInputStream
closed, flushedPosition, markedPositions, position
-
Constructor Summary
ConstructorsConstructorDescriptionMemoryCacheSeekableStream
(InputStream pStream) Creates aMemoryCacheSeekableStream
, reading from the givenInputStream
. -
Method Summary
Modifier and TypeMethodDescriptionfinal boolean
Returns true if thisSeekable
stream caches data itself in order to allow seeking backwards, and the cache is kept in a temporary file.final boolean
Returns true if thisSeekable
stream caches data itself in order to allow seeking backwards, and the cache is kept in main memory.Methods inherited from class com.twelvemonkeys.io.AbstractCachedSeekableStream
available, closeImpl, flushBeforeImpl, getCache, isCached, read, read, seekImpl, syncPosition
Methods inherited from class com.twelvemonkeys.io.SeekableInputStream
checkOpen, close, finalize, flush, flushBefore, getFlushedPosition, getStreamPosition, mark, mark, markSupported, read, reset, seek, skip
Methods inherited from class java.io.InputStream
nullInputStream, readAllBytes, readNBytes, readNBytes, skipNBytes, transferTo
-
Constructor Details
-
MemoryCacheSeekableStream
Creates aMemoryCacheSeekableStream
, reading from the givenInputStream
. Data will be cached in memory.- Parameters:
pStream
- theInputStream
to read from.
-
-
Method Details
-
isCachedMemory
public final boolean isCachedMemory()Description copied from interface:Seekable
Returns true if thisSeekable
stream caches data itself in order to allow seeking backwards, and the cache is kept in main memory. Applications may consult this in order to decide how frequently, or whether, to flush in order to conserve cache resources.- Specified by:
isCachedMemory
in interfaceSeekable
- Specified by:
isCachedMemory
in classAbstractCachedSeekableStream
- Returns:
true
if thisSeekable
caches data in main memory.- See Also:
-
isCachedFile
public final boolean isCachedFile()Description copied from interface:Seekable
Returns true if thisSeekable
stream caches data itself in order to allow seeking backwards, and the cache is kept in a temporary file. Applications may consult this in order to decide how frequently, or whether, to flush in order to conserve cache resources.- Specified by:
isCachedFile
in interfaceSeekable
- Specified by:
isCachedFile
in classAbstractCachedSeekableStream
- Returns:
true
if thisSeekable
caches data in a temporary file.- See Also:
-