Class FileCacheSeekableStream.FileCache
java.lang.Object
com.twelvemonkeys.io.AbstractCachedSeekableStream.StreamCache
com.twelvemonkeys.io.FileCacheSeekableStream.FileCache
- Enclosing class:
FileCacheSeekableStream
static final class FileCacheSeekableStream.FileCache
extends AbstractCachedSeekableStream.StreamCache
- Version:
- $Id: //depot/branches/personal/haraldk/twelvemonkeys/release-2/twelvemonkeys-core/src/main/java/com/twelvemonkeys/io/FileCacheSeekableStream.java#5 $
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) voidclose()longReturns the current cache read/write position.intread()Reads a single byte a the current read/write position.intread(byte[] pBuffer, int pOffset, int pLength) Writes a series of bytes at the current read/write position.voidseek(long pPosition) Repositions the current cache read/write position to the given position.voidwrite(byte[] pBuffer, int pOffset, int pLength) Writes a series of bytes at the current read/write position.voidwrite(int pByte) Writes a single byte at the current read/write position.Methods inherited from class AbstractCachedSeekableStream.StreamCache
flush
-
Field Details
-
cacheFile
-
-
Constructor Details
-
FileCache
- Throws:
FileNotFoundException
-
-
Method Details
-
write
Description copied from class:AbstractCachedSeekableStream.StreamCacheWrites a single byte at the current read/write position. The read/write position will be increased by one.- Specified by:
writein classAbstractCachedSeekableStream.StreamCache- Parameters:
pByte- the byte value to write.- Throws:
IOException- if an I/O exception occurs in the cache backing mechanism.
-
write
Description copied from class:AbstractCachedSeekableStream.StreamCacheWrites a series of bytes at the current read/write position. The read/write position will be increased bypLength.This implementation invokes
AbstractCachedSeekableStream.StreamCache.write(int)pLengthtimes. Subclasses may override this method for performance.- Overrides:
writein classAbstractCachedSeekableStream.StreamCache- Parameters:
pBuffer- the bytes to write.pOffset- the starting offset into the buffer.pLength- the number of bytes to write from the buffer.- Throws:
IOException- if an I/O exception occurs in the cache backing mechanism.
-
read
Description copied from class:AbstractCachedSeekableStream.StreamCacheReads a single byte a the current read/write position. The read/write position will be increased by one.- Specified by:
readin classAbstractCachedSeekableStream.StreamCache- Returns:
- the value read, or
-1to indicate EOF. - Throws:
IOException- if an I/O exception occurs in the cache backing mechanism.
-
read
Description copied from class:AbstractCachedSeekableStream.StreamCacheWrites a series of bytes at the current read/write position. The read/write position will be increased bypLength.This implementation invokes
AbstractCachedSeekableStream.StreamCache.read()pLengthtimes. Subclasses may override this method for performance.- Overrides:
readin classAbstractCachedSeekableStream.StreamCache- Parameters:
pBuffer- the bytes to writepOffset- the starting offset into the buffer.pLength- the number of bytes to write from the buffer.- Returns:
- the number of bytes read, or
-1to indicate EOF. - Throws:
IOException- if an I/O exception occurs in the cache backing mechanism.
-
seek
Description copied from class:AbstractCachedSeekableStream.StreamCacheRepositions the current cache read/write position to the given position.- Specified by:
seekin classAbstractCachedSeekableStream.StreamCache- Parameters:
pPosition- the new read/write position- Throws:
IOException- if an I/O exception occurs in the cache backing mechanism.
-
getPosition
Description copied from class:AbstractCachedSeekableStream.StreamCacheReturns the current cache read/write position.- Specified by:
getPositionin classAbstractCachedSeekableStream.StreamCache- Returns:
- the current cache read/write postion.
- Throws:
IOException- if the position can't be determined because of a problem in the cache backing mechanism.
-
close
- Specified by:
closein classAbstractCachedSeekableStream.StreamCache- Throws:
IOException
-