ImageOutputStream that writes its
output to a regular OutputStream. A memory buffer is
used to cache at least the data between the discard position and
the current write position. The only constructor takes an
OutputStream, so this class may not be used for
read/modify/write operations. Reading can occur only on parts of
the stream that have already been written to the cache and not
yet flushed.
| Modifier and Type | Field and Description |
|---|---|
| private MemoryCache | |
| private OutputStream |
| Access | Constructor and Description |
|---|---|
| public | MemoryCacheImageOutputStream(OutputStream
an stream)OutputStream to write to.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: false.Overrides javax. Implements javax. Returns |
| public boolean | Returns: true.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 | 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 MemoryCache cache | |
| stream | back to summary |
|---|---|
| private OutputStream stream | |
| MemoryCacheImageOutputStream | back to summary |
|---|---|
| public MemoryCacheImageOutputStream(OutputStream 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. 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.
| |
| 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
| |