Package org.apache.commons.compress.archivers.jar

# Class JarArchiveOutputStream

java.lang.Object
java.io.OutputStream
java.io.FilterOutputStream
org.apache.commons.compress.CompressFilterOutputStream<OutputStream>
org.apache.commons.compress.archivers.ArchiveOutputStream<ZipArchiveEntry>
org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream
org.apache.commons.compress.archivers.jar.JarArchiveOutputStream

All Implemented Interfaces:
  `Closeable`, `Flushable`, `AutoCloseable`

public class JarArchiveOutputStream extends ZipArchiveOutputStream
Subclass that adds a special extra field to the very first entry which allows the created archive to be used as an executable jar on Solaris.

This class is not thread-safe

- ## Nested Class Summary

  ## Nested classes/interfaces inherited from class org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream

  `ZipArchiveOutputStream.UnicodeExtraFieldPolicy`

- ## Field Summary

  ### Fields inherited from class org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream

  `def, DEFAULT_COMPRESSION, DEFLATED, EFS_FLAG, finished, STORED`

  ### Fields inherited from class java.io.FilterOutputStream

  `out`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `JarArchiveOutputStream(OutputStream out)`
  Constructs a new instance that wraps the output stream.
  `JarArchiveOutputStream(OutputStream out, String encoding)`
  Constructs a new instance that wraps the output stream using the provided encoding.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `putArchiveEntry(ZipArchiveEntry entry)`
  Writes the headers for an archive entry to the output stream.

  ### Methods inherited from class org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream

  `addRawArchiveEntry, canWriteEntryData, close, closeArchiveEntry, createArchiveEntry, createArchiveEntry, deflate, finish, flush, getBytesWritten, getEncoding, isSeekable, setComment, setCreateUnicodeExtraFields, setEncoding, setFallbackToUTF8, setLevel, setMethod, setUseLanguageEncodingFlag, setUseZip64, write, writeCentralDirectoryEnd, writeCentralFileHeader, writeDataDescriptor, writeLocalFileHeader, writeOut, writeOut, writePreamble, writePreamble, writeZip64CentralDirectory`

  ### Methods inherited from class org.apache.commons.compress.archivers.ArchiveOutputStream

  `checkFinished, count, count, getCount, write`

  ### Methods inherited from class org.apache.commons.compress.CompressFilterOutputStream

  `checkOpen, isClosed, isFinished, out, write, write, writeUsAscii, writeUsAsciiRaw, writeUtf8`

  ### Methods inherited from class java.io.FilterOutputStream

  `write`

  ### Methods inherited from class java.lang.Object

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

- ## Constructor Details

  - ### JarArchiveOutputStream

    public JarArchiveOutputStream(OutputStream out)
    Constructs a new instance that wraps the output stream.
    Parameters:
      `out` - the output stream to wrap.

  - ### JarArchiveOutputStream

    public JarArchiveOutputStream(OutputStream out, String encoding)
    Constructs a new instance that wraps the output stream using the provided encoding.
    Parameters:
      `out` - the output stream to wrap
      `encoding` - the encoding to use. Use null for the platform default.
    Since:
      1.10

- ## Method Details

  - ### putArchiveEntry

    public void putArchiveEntry(ZipArchiveEntry entry) throws IOException
    Description copied from class: `ZipArchiveOutputStream`
    Writes the headers for an archive entry to the output stream. The caller must then write the content to the stream and call `ArchiveOutputStream.closeArchiveEntry()` to complete the process.
    Overrides:
      `putArchiveEntry` in class `ZipArchiveOutputStream`
    Parameters:
      `entry` - describes the entry
    Throws:
      `IOException` - if an I/O error occurs