Class MemoryCache
java.lang.Object
com.twelvemonkeys.imageio.stream.MemoryCache
- All Implemented Interfaces:
Cache, Closeable, AutoCloseable, ByteChannel, Channel, ReadableByteChannel, SeekableByteChannel, WritableByteChannel
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) static final intprivate final List<byte[]> private final ReadableByteChannelprivate longprivate intprivate static final byte[]private longprivate long -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()(package private) byte[]voidflushBefore(long pos) booleanisOpen()longposition()position(long newPosition) intread(ByteBuffer dest) private intreadBlock(byte[] block) longsize()truncate(long size) intwrite(ByteBuffer src)
-
Field Details
-
BLOCK_SIZE
static final int BLOCK_SIZE- See Also:
-
NULL_BLOCK
private static final byte[] NULL_BLOCK -
cache
-
channel
-
maxBlock
private int maxBlock -
length
private long length -
position
private long position -
start
private long start
-
-
Constructor Details
-
MemoryCache
MemoryCache(InputStream stream) -
MemoryCache
-
-
Method Details
-
fetchBlock
- Throws:
IOException
-
readBlock
- Throws:
IOException
-
isOpen
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceChannel- Specified by:
closein interfaceCloseable- Throws:
IOException
-
read
- Specified by:
readin interfaceReadableByteChannel- Specified by:
readin interfaceSeekableByteChannel- Throws:
IOException
-
position
- Specified by:
positionin interfaceSeekableByteChannel- Throws:
IOException
-
position
- Specified by:
positionin interfaceSeekableByteChannel- Throws:
IOException
-
size
- Specified by:
sizein interfaceSeekableByteChannel- Throws:
IOException
-
write
- Specified by:
writein interfaceSeekableByteChannel- Specified by:
writein interfaceWritableByteChannel
-
truncate
- Specified by:
truncatein interfaceSeekableByteChannel
-
flushBefore
public void flushBefore(long pos) - Specified by:
flushBeforein interfaceCache
-