Package com.twelvemonkeys.imageio.stream
Class FileCache
- java.lang.Object
-
- com.twelvemonkeys.imageio.stream.FileCache
-
- All Implemented Interfaces:
Cache
,java.io.Closeable
,java.lang.AutoCloseable
,java.nio.channels.ByteChannel
,java.nio.channels.Channel
,java.nio.channels.ReadableByteChannel
,java.nio.channels.SeekableByteChannel
,java.nio.channels.WritableByteChannel
final class FileCache extends java.lang.Object implements Cache
-
-
Field Summary
Fields Modifier and Type Field Description (package private) static int
BLOCK_SIZE
private java.nio.channels.FileChannel
cache
private java.nio.channels.ReadableByteChannel
channel
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
(package private) void
fetch()
void
flushBefore(long pos)
boolean
isOpen()
long
position()
java.nio.channels.SeekableByteChannel
position(long newPosition)
int
read(java.nio.ByteBuffer dest)
long
size()
java.nio.channels.SeekableByteChannel
truncate(long size)
int
write(java.nio.ByteBuffer src)
-
-
-
Field Detail
-
BLOCK_SIZE
static final int BLOCK_SIZE
- See Also:
- Constant Field Values
-
cache
private final java.nio.channels.FileChannel cache
-
channel
private final java.nio.channels.ReadableByteChannel channel
-
-
Method Detail
-
fetch
void fetch() throws java.io.IOException
- Throws:
java.io.IOException
-
isOpen
public boolean isOpen()
- Specified by:
isOpen
in interfacejava.nio.channels.Channel
-
close
public void close() throws java.io.IOException
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.nio.channels.Channel
- Specified by:
close
in interfacejava.io.Closeable
- Throws:
java.io.IOException
-
read
public int read(java.nio.ByteBuffer dest) throws java.io.IOException
- Specified by:
read
in interfacejava.nio.channels.ReadableByteChannel
- Specified by:
read
in interfacejava.nio.channels.SeekableByteChannel
- Throws:
java.io.IOException
-
position
public long position() throws java.io.IOException
- Specified by:
position
in interfacejava.nio.channels.SeekableByteChannel
- Throws:
java.io.IOException
-
position
public java.nio.channels.SeekableByteChannel position(long newPosition) throws java.io.IOException
- Specified by:
position
in interfacejava.nio.channels.SeekableByteChannel
- Throws:
java.io.IOException
-
size
public long size()
- Specified by:
size
in interfacejava.nio.channels.SeekableByteChannel
-
write
public int write(java.nio.ByteBuffer src)
- Specified by:
write
in interfacejava.nio.channels.SeekableByteChannel
- Specified by:
write
in interfacejava.nio.channels.WritableByteChannel
-
truncate
public java.nio.channels.SeekableByteChannel truncate(long size)
- Specified by:
truncate
in interfacejava.nio.channels.SeekableByteChannel
-
flushBefore
public void flushBefore(long pos)
- Specified by:
flushBefore
in interfaceCache
-
-