Package com.twelvemonkeys.imageio.stream
Class FileCache
java.lang.Object
com.twelvemonkeys.imageio.stream.FileCache
- All Implemented Interfaces:
Cache
,Closeable
,AutoCloseable
,ByteChannel
,Channel
,ReadableByteChannel
,SeekableByteChannel
,WritableByteChannel
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) static final int
private final FileChannel
private final ReadableByteChannel
-
Constructor Summary
ConstructorsConstructorDescriptionFileCache
(InputStream stream, File cacheDir) FileCache
(ReadableByteChannel channel, File cacheDir) -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
(package private) void
fetch()
void
flushBefore
(long pos) boolean
isOpen()
long
position()
position
(long newPosition) int
read
(ByteBuffer dest) long
size()
truncate
(long size) int
write
(ByteBuffer src)
-
Field Details
-
BLOCK_SIZE
static final int BLOCK_SIZE- See Also:
-
cache
-
channel
-
-
Constructor Details
-
FileCache
FileCache(InputStream stream, File cacheDir) throws IOException - Throws:
IOException
-
FileCache
- Throws:
IOException
-
-
Method Details
-
fetch
- Throws:
IOException
-
isOpen
public boolean isOpen() -
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceChannel
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-
read
- Specified by:
read
in interfaceReadableByteChannel
- Specified by:
read
in interfaceSeekableByteChannel
- Throws:
IOException
-
position
- Specified by:
position
in interfaceSeekableByteChannel
- Throws:
IOException
-
position
- Specified by:
position
in interfaceSeekableByteChannel
- Throws:
IOException
-
size
public long size()- Specified by:
size
in interfaceSeekableByteChannel
-
write
- Specified by:
write
in interfaceSeekableByteChannel
- Specified by:
write
in interfaceWritableByteChannel
-
truncate
- Specified by:
truncate
in interfaceSeekableByteChannel
-
flushBefore
public void flushBefore(long pos) - Specified by:
flushBefore
in interfaceCache
-