ImageOutputStreamImpl (Java SE 15 & JDK 15)
Description: declaration: module: java.desktop, package: javax.imageio.stream, class: ImageOutputStreamImpl
Keywords: javax.imageio.stream.ImageOutputStreamImpl class

Module java.desktop
Package javax.imageio.stream

# Class ImageOutputStreamImpl

java.lang.Object
javax.imageio.stream.ImageInputStreamImpl
javax.imageio.stream.ImageOutputStreamImpl

All Implemented Interfaces:
  `Closeable`, `DataInput`, `DataOutput`, `AutoCloseable`, `ImageInputStream`, `ImageOutputStream`

Direct Known Subclasses:
  `FileCacheImageOutputStream`, `FileImageOutputStream`, `MemoryCacheImageOutputStream`

    public abstract class ImageOutputStreamImpl
    extends ImageInputStreamImpl
    implements ImageOutputStream

An abstract class implementing the `ImageOutputStream` interface. This class is designed to reduce the number of methods that must be implemented by subclasses.

- ## Field Summary

  ### Fields declared in class javax.imageio.stream.ImageInputStreamImpl

  `bitOffset, byteOrder, flushedPos, streamPos`

- ## Constructor Summary

  Constructors
  Constructor | Description
  --- | ---
  `ImageOutputStreamImpl()` | Constructs an `ImageOutputStreamImpl`.

- ## Method Summary

  Modifier and Type | Method | Description
  --- | --- | ---
  `protected void` | `flushBits()` | If the bit offset is non-zero, forces the remaining bits in the current byte to 0 and advances the stream position by one.

  ### Methods declared in class javax.imageio.stream.ImageInputStreamImpl

  `checkClosed, finalize, isCached, isCachedFile, isCachedMemory, length, mark, read, read, read, reset, skipBytes, skipBytes`

  ### Methods declared in class java.lang.Object

  `clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

  ### Methods declared in interface javax.imageio.stream.ImageInputStream

  `close, flush, getBitOffset, getByteOrder, getFlushedPosition, getStreamPosition, isCached, isCachedFile, isCachedMemory, length, mark, read, read, read, readBit, readBits, readBoolean, readByte, readBytes, readChar, readDouble, readFloat, readFully, readFully, readFully, readFully, readFully, readFully, readFully, readFully, readInt, readLine, readLong, readShort, readUnsignedByte, readUnsignedInt, readUnsignedShort, readUTF, reset, seek, setBitOffset, setByteOrder, skipBytes, skipBytes`

  ### Methods declared in interface javax.imageio.stream.ImageOutputStream

  `flushBefore, write, write, write, writeBit, writeBits, writeBoolean, writeByte, writeBytes, writeChar, writeChars, writeChars, writeDouble, writeDoubles, writeFloat, writeFloats, writeInt, writeInts, writeLong, writeLongs, writeShort, writeShorts, writeUTF`

- ## Constructor Details

  - ### ImageOutputStreamImpl

    public ImageOutputStreamImpl()
    Constructs an `ImageOutputStreamImpl`.

- ## Method Details

  - ### flushBits

    protected final void flushBits() throws IOException
    If the bit offset is non-zero, forces the remaining bits in the current byte to 0 and advances the stream position by one. This method should be called by subclasses at the beginning of the `write(int)` and `write(byte[], int, int)` methods.
    Throws:
      `IOException` - if an I/O error occurs.