ImageOutputStream that writes its
output to a regular OutputStream. A file is used to
cache data until it is flushed to the output stream.
| Modifier and Type | Field and Description |
|---|---|
| private RandomAccessFile | |
| private File | |
| private final StreamCloser. | closeAction
The CloseAction that closes the stream in the StreamCloser's shutdown hook |
| private final FileCacheImageInputStream. | |
| private final Object | |
| private long | |
| private OutputStream |
| Access | Constructor and Description |
|---|---|
| public | FileCacheImageOutputStream(OutputStream
an stream, File OutputStream to write to.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 void | flushBefore(long pos)
Overrides javax. Implements javax. Flushes all data prior to the given position to the underlying
destination, such as an |
| 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 long | length()
Overrides javax. Implements javax. Returns the total length of the stream, if known. |
| public int | read()
Implements abstract javax. Implements javax. Reads a single byte from the stream and returns it as an integer between 0 and 255. |
| public int | read(byte[] b, int off, int len)
Implements abstract javax. Implements javax. Reads up to |
| public void | seek(long pos)
Overrides javax. Implements javax. Sets the current stream position and resets the bit offset to 0. |
| public void | write(int b)
Implements abstract javax. Implements javax. Writes a single byte to the stream at the current position. |
| public void | write(byte[] b, int off, int len)
Implements abstract javax. Implements javax. Writes a sequence of bytes to the stream at the current position. |
| 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 FileCacheImageInputStream. | |
| disposerReferent | back to summary |
|---|---|
| private final Object disposerReferent | |
| maxStreamPos | back to summary |
|---|---|
| private long maxStreamPos | |
| stream | back to summary |
|---|---|
| private OutputStream stream | |
| FileCacheImageOutputStream | back to summary |
|---|---|
| public FileCacheImageOutputStream(OutputStream 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
| |
| flushBefore | back to summary |
|---|---|
| public void flushBefore(long pos) throws IOException Overrides javax. Implements javax. Doc from javax. Flushes all data prior to the given position to the underlying
destination, such as an
| |
| 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
| |
| length | back to summary |
|---|---|
| public long length() Overrides javax. Implements javax. Doc from javax. Returns the total length of the stream, if known. Otherwise,
| |
| 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 integer between 0 and 255. If the end of the stream is reached, -1 is returned. The bit offset within the stream is 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 is reset to zero before the read occurs.
| |
| seek | back to summary |
|---|---|
| public void seek(long pos) throws IOException Overrides javax. Implements javax. Sets the current stream position and resets the bit offset to
0. It is legal to seek past the end of the file; an
| |
| write | back to summary |
|---|---|
| public void write(int b) throws IOException Implements abstract javax. Implements javax. Doc from javax. Writes a single byte to the stream at the current position.
The 24 high-order bits of If the bit offset within the stream is non-zero, the
remainder of the current byte is padded with 0s
and written out first. The bit offset will be 0 after the
write. Implementers can use the
| |
| write | back to summary |
|---|---|
| public void write(byte[] b, int off, int len) throws IOException Implements abstract javax. Implements javax. Doc from javax. Writes a sequence of bytes to the stream at the current
position. If If the bit offset within the stream is non-zero, the
remainder of the current byte is padded with 0s
and written out first. The bit offset will be 0 after the
write. Implementers can use the
| |