|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.io.InputStream
com.twelvemonkeys.io.SeekableInputStream
com.twelvemonkeys.io.FileCacheSeekableStream
public final class FileCacheSeekableStream
A SeekableInputStream implementation that caches data in a temporary File.
File.createTempFile(String, String, java.io.File).
MemoryCacheSeekableStream,
FileSeekableStream,
File.createTempFile(String, String),
RandomAccessFile| Nested Class Summary | |
|---|---|
static class |
AbstractCachedSeekableStream.StreamCache
An abstract stream cache. |
| Field Summary | |
|---|---|
protected java.io.InputStream |
stream
The backing stream |
protected long |
streamPosition
The stream positon in the backing stream (stream) |
| Fields inherited from class com.twelvemonkeys.io.SeekableInputStream |
|---|
markedPositions |
| Constructor Summary | |
|---|---|
FileCacheSeekableStream(java.io.InputStream pStream)
Creates a FileCacheSeekableStream reading from the given
InputStream. |
|
FileCacheSeekableStream(java.io.InputStream pStream,
java.lang.String pTempBaseName)
Creates a FileCacheSeekableStream reading from the given
InputStream. |
|
FileCacheSeekableStream(java.io.InputStream pStream,
java.lang.String pTempBaseName,
java.io.File pTempDir)
Creates a FileCacheSeekableStream reading from the given
InputStream. |
|
| Method Summary | |
|---|---|
int |
available()
|
protected void |
closeImpl()
|
protected void |
flushBeforeImpl(long pPosition)
Discards the initial portion of the stream prior to the indicated postion. |
protected AbstractCachedSeekableStream.StreamCache |
getCache()
|
boolean |
isCached()
Returns true if this Seekable stream caches data itself in order
to allow seeking backwards. |
boolean |
isCachedFile()
Returns true if this Seekable stream caches data itself in
order to allow seeking backwards, and the cache is kept in a
temporary file. |
boolean |
isCachedMemory()
Returns true if this Seekable stream caches data itself in order
to allow seeking backwards, and the cache is kept in main memory. |
int |
read()
|
int |
read(byte[] pBytes,
int pOffset,
int pLength)
|
protected void |
seekImpl(long pPosition)
|
protected void |
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.lang.Object |
|---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected final java.io.InputStream stream
protected long streamPosition
| Constructor Detail |
|---|
public FileCacheSeekableStream(java.io.InputStream pStream)
throws java.io.IOException
FileCacheSeekableStream reading from the given
InputStream. Data will be cached in a temporary file.
pStream - the InputStream to read from
java.io.IOException - if the temporary file cannot be created,
or cannot be opened for random access.
public FileCacheSeekableStream(java.io.InputStream pStream,
java.lang.String pTempBaseName)
throws java.io.IOException
FileCacheSeekableStream reading from the given
InputStream. Data will be cached in a temporary file, with
the given base name.
pStream - the InputStream to read frompTempBaseName - optional base name for the temporary file
java.io.IOException - if the temporary file cannot be created,
or cannot be opened for random access.
public FileCacheSeekableStream(java.io.InputStream pStream,
java.lang.String pTempBaseName,
java.io.File pTempDir)
throws java.io.IOException
FileCacheSeekableStream reading from the given
InputStream. Data will be cached in a temporary file, with
the given base name, in the given directory
pStream - the InputStream to read frompTempBaseName - optional base name for the temporary filepTempDir - optional temp directory
java.io.IOException - if the temporary file cannot be created,
or cannot be opened for random access.| Method Detail |
|---|
public final boolean isCachedMemory()
SeekableSeekable 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.
isCachedMemory in interface Seekabletrue if this Seekable caches data in main
memory.Seekable.isCached(),
Seekable.isCachedFile()public final boolean isCachedFile()
SeekableSeekable 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.
isCachedFile in interface Seekabletrue if this Seekable caches data in a
temporary file.Seekable.isCached(),
Seekable.isCachedMemory()
protected void closeImpl()
throws java.io.IOException
java.io.IOException
public int read()
throws java.io.IOException
java.io.IOException
public int read(byte[] pBytes,
int pOffset,
int pLength)
throws java.io.IOException
java.io.IOExceptionprotected final AbstractCachedSeekableStream.StreamCache getCache()
public int available()
throws java.io.IOException
available in class java.io.InputStreamjava.io.IOException
protected final void syncPosition()
throws java.io.IOException
java.io.IOExceptionpublic final boolean isCached()
SeekableSeekable stream caches data itself in order
to allow seeking backwards. Applications may consult this in order to
decide how frequently, or whether, to flush in order to conserve cache
resources.
true if this Seekable caches data.Seekable.isCachedMemory(),
Seekable.isCachedFile()
protected void seekImpl(long pPosition)
throws java.io.IOException
seekImpl in class SeekableInputStreamjava.io.IOExceptionprotected void flushBeforeImpl(long pPosition)
SeekableInputStream
flushBeforeImpl in class SeekableInputStreampPosition - the position to flush toSeekableInputStream.flushBefore(long)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||