ImageInputStream that gets its
input from a regular InputStream. A memory buffer is
used to cache at least the data between the discard position and
the current read position.
In general, it is preferable to use a
FileCacheImageInputStream when reading from a regular
InputStream. This class is provided for cases where
it is not possible to create a writable temporary file.
| Modifier and Type | Field and Description |
|---|---|
| private MemoryCache | |
| private InputStream |
| Access | Constructor and Description |
|---|---|
| public | MemoryCacheImageInputStream(InputStream
an stream)InputStream to read from.Constructs a |
| Modifier and Type | Method and Description |
|---|---|
| public void | close()
Overrides javax. Implements javax. Closes this |
| public void | flushBefore(long pos)
Overrides javax. Implements javax. Discards the initial portion of the stream prior to the indicated position. |
| public boolean | Returns: true.Overrides javax. Implements javax. Returns |
| public boolean | Returns: false.Overrides javax. Implements javax. Returns |
| public boolean | Returns: true.Overrides javax. Implements javax. Returns |
| public int | read()
Implements abstract javax. Implements javax. Reads a single byte from the stream and returns it as an
|
| public int | read(byte[] b, int off, int len)
Implements abstract javax. Implements javax. Reads up to |
| cache | back to summary |
|---|---|
| private MemoryCache cache | |
| stream | back to summary |
|---|---|
| private InputStream stream | |
| MemoryCacheImageInputStream | back to summary |
|---|---|
| public MemoryCacheImageInputStream(InputStream stream) Constructs a
| |
| close | back to summary |
|---|---|
| public void close() throws IOException Overrides javax. Implements javax. Closes this
| |
| flushBefore | back to summary |
|---|---|
| public void flushBefore(long pos) throws IOException Overrides javax. Implements javax. Doc from javax. Discards the initial portion of the stream prior to the
indicated position. Attempting to seek to an offset within the
flushed portion of the stream will result in an
Calling
| |
| isCached | back to summary |
|---|---|
| public boolean isCached() Overrides javax. Implements javax. Returns
| |
| isCachedFile | back to summary |
|---|---|
| public boolean isCachedFile() Overrides javax. Implements javax. Returns
| |
| isCachedMemory | back to summary |
|---|---|
| public boolean isCachedMemory() Overrides javax. Implements javax. Returns
| |
| read | back to summary |
|---|---|
| public int read() throws IOException Implements abstract javax. Implements javax. Doc from javax. Reads a single byte from the stream and returns it as an
Subclasses must provide an implementation for this method. The subclass implementation should update the stream position before exiting. The bit offset within the stream must be reset to zero before the read occurs.
| |
| read | back to summary |
|---|---|
| public int read(byte[] b, int off, int len) throws IOException Implements abstract javax. Implements javax. Doc from javax. Reads up to The bit offset within the stream must be reset to zero before the read occurs. Subclasses must provide an implementation for this method. The subclass implementation should update the stream position before exiting.
| |