Class StreamZipWriter
- 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 Summary
Constructors Constructor Description StreamZipWriter(@NonNull OutputStream zippedOutputStream, @NonNull org.apache.commons.compress.archivers.zip.ParallelScatterZipCreator scatterZipCreator)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Locking method that waits for all data to be archived and closes necessary resources.void
compressFromStream(InputStream streamToZip, String pathInZip)
Compresses data from the provided input stream into an archive.void
compressFromStream(InputStream streamToZip, String pathInZip, String comment)
Compresses data from the provided input stream into an archive.void
compressFromStreamSupplier(org.apache.commons.compress.parallel.InputStreamSupplier streamSupplier, String pathInZip)
Compresses data from the provided input stream supplier into an archive.void
compressFromStreamSupplier(org.apache.commons.compress.parallel.InputStreamSupplier streamSupplier, String pathInZip, String comment)
Compresses data from the provided input stream supplier into an archive.
-
-
-
Constructor Detail
-
StreamZipWriter
public StreamZipWriter(@NonNull OutputStream zippedOutputStream, @NonNull org.apache.commons.compress.archivers.zip.ParallelScatterZipCreator scatterZipCreator) throws IOException
- Throws:
IOException
-
-
Method Detail
-
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 interfaceArchiveWriter
- Parameters:
streamSupplier
- - source stream supplierpathInZip
- - 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 interfaceArchiveWriter
- Parameters:
streamSupplier
- - source stream supplierpathInZip
- - path in the archive where entry is written tocomment
- - 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 interfaceArchiveWriter
- Parameters:
streamToZip
- - source streampathInZip
- - 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 interfaceArchiveWriter
- Parameters:
streamToZip
- - source streampathInZip
- - path in the archive where entry is written tocomment
- - 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 interfaceArchiveWriter
- Specified by:
close
in interfaceAutoCloseable
- Throws:
BackupRestoreException
- - throws if any exception occurred
-
-