java.lang.Object
com.atlassian.confluence.impl.backuprestore.backup.container.StreamZipWriter
All Implemented Interfaces:
ArchiveWriter, AutoCloseable

public class StreamZipWriter extends Object implements ArchiveWriter
Compresses a data stream into a zip archive.
Since:
7.20.0
  • Constructor Details

    • StreamZipWriter

      public StreamZipWriter(@NonNull OutputStream zippedOutputStream, @NonNull org.apache.commons.compress.archivers.zip.ParallelScatterZipCreator scatterZipCreator) throws IOException
      Throws:
      IOException
  • Method Details

    • compressFromStreamSupplier

      public void compressFromStreamSupplier(org.apache.commons.compress.parallel.InputStreamSupplier streamSupplier, String pathInZip)
      Description copied from interface: ArchiveWriter
      Compresses data from the provided input stream supplier into an archive. The provided input stream will be closed by the ArchiveWriter implementation. Use this method if all data is available for compression when the stream opens.
      Specified by:
      compressFromStreamSupplier in interface ArchiveWriter
      Parameters:
      streamSupplier - - source stream supplier
      pathInZip - - path in the archive where entry is written to
    • compressFromStreamSupplier

      public void compressFromStreamSupplier(org.apache.commons.compress.parallel.InputStreamSupplier streamSupplier, String pathInZip, String comment)
      Description copied from interface: ArchiveWriter
      Compresses data from the provided input stream supplier into an archive. The provided input stream will be closed by the ArchiveWriter implementation. Use this method if all data is available for compression when the stream opens. You can use the comment param to avoid issue with uniqueness of zip entries (potential crash). See CONFSRVDEV-25060 for more details.
      Specified by:
      compressFromStreamSupplier in interface ArchiveWriter
      Parameters:
      streamSupplier - - source stream supplier
      pathInZip - - path in the archive where entry is written to
      comment - - comment for the compressed file
    • compressFromStream

      public void compressFromStream(InputStream streamToZip, String pathInZip)
      Description copied from interface: ArchiveWriter
      Compresses data from the provided input stream into an archive. The input stream will be closed by the ArchiveWriter implementation. Use this method if the streamed data size is unknown when opened.
      Specified by:
      compressFromStream in interface ArchiveWriter
      Parameters:
      streamToZip - - source stream
      pathInZip - - path in the archive where entry is written to
    • compressFromStream

      public void compressFromStream(InputStream streamToZip, String pathInZip, String comment)
      Description copied from interface: ArchiveWriter
      Compresses data from the provided input stream into an archive. The input stream will be closed by the ArchiveWriter implementation. Use this method if the streamed data size is unknown when opened. You can use the comment param to avoid issue with uniqueness of zip entries (potential crash). See CONFSRVDEV-25060 for more details.
      Specified by:
      compressFromStream in interface ArchiveWriter
      Parameters:
      streamToZip - - source stream
      pathInZip - - path in the archive where entry is written to
      comment - - additional comment stored with the compressed file
    • close

      public void close() throws BackupRestoreException
      Description copied from interface: ArchiveWriter
      Locking method that waits for all data to be archived and closes necessary resources.
      Specified by:
      close in interface ArchiveWriter
      Specified by:
      close in interface AutoCloseable
      Throws:
      BackupRestoreException - - throws if any exception occurred