Class ZipOutputStream

  • All Implemented Interfaces:
    Closeable, Flushable, AutoCloseable

    public abstract class ZipOutputStream
    extends FilterOutputStream

    An output stream filter for writing files in the ZIP file format. Only compressed (deflated) entries are supported.

    Instances of this class are not thread safe.

    Since:
    2017.2.4, 2018.1
    Author:
    Andrey Shcheglov <mailto:andrey.shcheglov@jetbrains.com>
    See Also:
    Deflater
    • Method Detail

      • write

        public final void write​(int b)
                         throws IOException

        Writes a byte to the compressed output stream. This method will block until the byte can be written.

        Overrides:
        write in class FilterOutputStream
        Parameters:
        b - the byte to be written.
        Throws:
        IOException - if an I/O error has occurred.
      • write

        public final void write​(@NotNull
                                byte[] data,
                                int offset,
                                int length)
                         throws IOException

        Writes an array of bytes to the current ZIP entry data. This method will block until all the bytes are written.

        Overrides:
        write in class FilterOutputStream
        Parameters:
        data - the data to be written.
        offset - the start offset in the data.
        length - the number of bytes that are written.
        Throws:
        ZipException - if a ZIP file error has occurred.
        IOException - if an I/O error has occurred.
        InterruptedIOException - if the thread has been interrupted.