Package com.twelvemonkeys.imageio.stream
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 int
private final List
<byte[]> private final ReadableByteChannel
private long
private int
private static final byte[]
private long
private long
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
(package private) byte[]
void
flushBefore
(long pos) boolean
isOpen()
long
position()
position
(long newPosition) int
read
(ByteBuffer dest) private int
readBlock
(byte[] block) long
size()
truncate
(long size) int
write
(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
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
- Specified by:
size
in interfaceSeekableByteChannel
- Throws:
IOException
-
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
-