public final class FileSeekableStream extends SeekableInputStream
SeekableInputStream
implementation that uses random access directly to a File
.
FileCacheSeekableStream
,
MemoryCacheSeekableStream
,
RandomAccessFile
markedPositions
Constructor and Description |
---|
FileSeekableStream(File pInput)
Creates a
FileSeekableStream that reads from the given
File . |
FileSeekableStream(RandomAccessFile pInput)
Creates a
FileSeekableStream that reads from the given file. |
Modifier and Type | Method and Description |
---|---|
int |
available() |
void |
closeImpl() |
protected void |
flushBeforeImpl(long pPosition)
Does nothing, as we don't really do any caching here.
|
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) |
checkOpen, close, finalize, flush, flushBefore, getFlushedPosition, getStreamPosition, mark, mark, markSupported, read, reset, seek, skip
public FileSeekableStream(File pInput) throws FileNotFoundException
FileSeekableStream
that reads from the given
File
.pInput
- file to read fromFileNotFoundException
- if pInput
does not existpublic FileSeekableStream(RandomAccessFile pInput)
FileSeekableStream
that reads from the given file.
The RandomAccessFile
needs only to be open in read
("r"
) mode.pInput
- file to read frompublic boolean isCached()
Seekable
Seekable
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()
public boolean isCachedFile()
Seekable
Seekable
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.true
if this Seekable
caches data in a
temporary file.Seekable.isCached()
,
Seekable.isCachedMemory()
public boolean isCachedMemory()
Seekable
Seekable
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.true
if this Seekable
caches data in main
memory.Seekable.isCached()
,
Seekable.isCachedFile()
public int available() throws IOException
available
in class InputStream
IOException
public void closeImpl() throws IOException
closeImpl
in class SeekableInputStream
IOException
public int read() throws IOException
read
in class InputStream
IOException
public int read(byte[] pBytes, int pOffset, int pLength) throws IOException
read
in class InputStream
IOException
protected void flushBeforeImpl(long pPosition)
flushBeforeImpl
in class SeekableInputStream
pPosition
- the position to flush toSeekableInputStream.flushBefore(long)
protected void seekImpl(long pPosition) throws IOException
seekImpl
in class SeekableInputStream
IOException
Copyright © 2017. All rights reserved.