javax.imageio.stream
Class MemoryCacheImageOutputStreamjava.lang.Object | +--javax.imageio.stream.ImageInputStreamImpl | +--javax.imageio.stream.ImageOutputStreamImpl | +--javax.imageio.stream.MemoryCacheImageOutputStream
- All Implemented Interfaces:
- DataInput, DataOutput, ImageInputStream, ImageOutputStream
- public class MemoryCacheImageOutputStream
- extends ImageOutputStreamImpl
An implementation of 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.
Field Summary
Fields inherited from class javax.imageio.stream.ImageInputStreamImpl bitOffset, byteOrder, flushedPos, streamPos
Constructor Summary
MemoryCacheImageOutputStream(OutputStream stream)
Constructs a MemoryCacheImageOutputStream that will write to a given OutputStream.
Method Summary
void close()
Closes this MemoryCacheImageOutputStream.void flushBefore(long pos)
Flushes all data prior to the given position to the underlying destination, such as an OutputStream or File.boolean isCached()
Returns true since this ImageOutputStream caches data in order to allow seeking backwards.boolean isCachedFile()
Returns false since this ImageOutputStream does not maintain a file cache.boolean isCachedMemory()
Returns true since this ImageOutputStream maintains a main memory cache.long length()
Returns the total length of the stream, if known.int read()
Reads a single byte from the stream and returns it as an integer between 0 and 255.int read(byte[] b, int off, int len)
Reads up to len bytes from the stream, and stores them into b starting at index off.void write(byte[] b, int off, int len)
Writes a sequence of bytes to the stream at the current position.void write(int b)
Writes a single byte to the stream at the current position.
Methods inherited from class javax.imageio.stream.ImageOutputStreamImpl flushBits,