ImageInputStream that gets its
input from a regular InputStream. A file is used to
cache previously read data.
| Modifier and Type | Class and Description |
|---|---|
| pack-priv static class |
| Modifier and Type | Field and Description |
|---|---|
| private byte[] | |
| private static final int | |
| private RandomAccessFile | |
| private File | |
| private final StreamCloser. | closeAction
The CloseAction that closes the stream in the StreamCloser's shutdown hook |
| private final DisposerRecord | disposerRecord
The DisposerRecord that closes the underlying cache. |
| private final Object | disposerReferent
The referent to be registered with the Disposer. |
| private boolean | |
| private long | |
| private InputStream |
| Access | Constructor and Description |
|---|---|
| public | FileCacheImageInputStream(InputStream
an stream, File InputStream to read from.a cacheDir)File indicating where the
cache file should be created, or null to use the
system directory.Constructs a |
| Modifier and Type | Method and Description |
|---|---|
| public void | close()
Overrides javax. Implements javax. Closes this |
| public boolean | Returns: true.Overrides javax. Implements javax. Returns |
| public boolean | Returns: true.Overrides javax. Implements javax. Returns |
| public boolean | Returns: false.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 |
| private long |
| buf | back to summary |
|---|---|
| private byte[] buf | |
| BUFFER_LENGTH | back to summary |
|---|---|
| private static final int BUFFER_LENGTH | |
| cache | back to summary |
|---|---|
| private RandomAccessFile cache | |
| cacheFile | back to summary |
|---|---|
| private File cacheFile | |
| closeAction | back to summary |
|---|---|
| private final StreamCloser. The CloseAction that closes the stream in the StreamCloser's shutdown hook | |
| disposerRecord | back to summary |
|---|---|
| private final DisposerRecord disposerRecord The DisposerRecord that closes the underlying cache. | |
| disposerReferent | back to summary |
|---|---|
| private final Object disposerReferent The referent to be registered with the Disposer. | |
| foundEOF | back to summary |
|---|---|
| private boolean foundEOF | |
| length | back to summary |
|---|---|
| private long length | |
| stream | back to summary |
|---|---|
| private InputStream stream | |
| FileCacheImageInputStream | back to summary |
|---|---|
| public FileCacheImageInputStream(InputStream stream, File cacheDir) throws IOException Constructs a A temporary file is used as a cache. If
| |
| close | back to summary |
|---|---|
| public void close() throws IOException Overrides javax. Implements javax. Closes this
| |
| 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.
| |
| readUntil | back to summary |
|---|---|
| private long readUntil(long pos) throws IOException Ensures that at least
| |
| Modifier and Type | Field and Description |
|---|---|
| private RandomAccessFile | |
| private File |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public synchronized void |
| cache | back to summary |
|---|---|
| private RandomAccessFile cache | |
| cacheFile | back to summary |
|---|---|
| private File cacheFile | |
| StreamDisposerRecord | back to summary |
|---|---|
| public StreamDisposerRecord(File cacheFile, RandomAccessFile cache) | |
| dispose | back to summary |
|---|---|
| public synchronized void dispose() Implements sun. | |