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 intBLOCK_SIZEprivate java.nio.channels.FileChannelcacheprivate java.nio.channels.ReadableByteChannelchannel
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()(package private) voidfetch()voidflushBefore(long pos)booleanisOpen()longposition()java.nio.channels.SeekableByteChannelposition(long newPosition)intread(java.nio.ByteBuffer dest)longsize()java.nio.channels.SeekableByteChanneltruncate(long size)intwrite(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:
isOpenin interfacejava.nio.channels.Channel
-
close
public void close() throws java.io.IOException- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.nio.channels.Channel- Specified by:
closein interfacejava.io.Closeable- Throws:
java.io.IOException
-
read
public int read(java.nio.ByteBuffer dest) throws java.io.IOException- Specified by:
readin interfacejava.nio.channels.ReadableByteChannel- Specified by:
readin interfacejava.nio.channels.SeekableByteChannel- Throws:
java.io.IOException
-
position
public long position() throws java.io.IOException- Specified by:
positionin interfacejava.nio.channels.SeekableByteChannel- Throws:
java.io.IOException
-
position
public java.nio.channels.SeekableByteChannel position(long newPosition) throws java.io.IOException- Specified by:
positionin interfacejava.nio.channels.SeekableByteChannel- Throws:
java.io.IOException
-
size
public long size()
- Specified by:
sizein interfacejava.nio.channels.SeekableByteChannel
-
write
public int write(java.nio.ByteBuffer src)
- Specified by:
writein interfacejava.nio.channels.SeekableByteChannel- Specified by:
writein interfacejava.nio.channels.WritableByteChannel
-
truncate
public java.nio.channels.SeekableByteChannel truncate(long size)
- Specified by:
truncatein interfacejava.nio.channels.SeekableByteChannel
-
flushBefore
public void flushBefore(long pos)
- Specified by:
flushBeforein interfaceCache
-
-