Package net.sf.sevenzipjbinding
Interface IOutCreateArchive<T extends IOutItemBase>
- Type Parameters:
T- the type of the corresponding archive item data class (out item), likeIOutItem7zorIOutItemZip. UseIOutItemAllFormatsinterface to support all available archive formats.
- All Superinterfaces:
AutoCloseable,Closeable,IOutArchiveBase
- All Known Subinterfaces:
IOutArchive<T>,IOutCreateArchive7z,IOutCreateArchiveBZip2,IOutCreateArchiveGZip,IOutCreateArchiveTar,IOutCreateArchiveXz,IOutCreateArchiveZip
- All Known Implementing Classes:
OutArchive7zImpl,OutArchiveBZip2Impl,OutArchiveGZipImpl,OutArchiveImpl,OutArchiveTarImpl,OutArchiveXzImpl,OutArchiveZipImpl
The central interface to create new archives. To update an existing archive open it first and then use
There are two ways of getting an implementation of this interface:
IInArchive.getConnectedOutArchive() to get an instance of the IOutUpdateArchive interface.There are two ways of getting an implementation of this interface:
- use
SevenZip.openOutArchive(ArchiveFormat)
The method returns an instance of theIOutCreateArchive<IOutItemAllFormats>interface allowing creation of a new archive of any supported archive format. To get all currently supported formats see the 'compression' column of theArchiveFormat-JavaDoc. The user can check whether the current archive format supports a particular configuration method by making aninstanceofcheck, like this:IOutCreateArchive
<IOutItemAllFormats>outArchive = SevenZip.openOutArchive(myArchiveFormat); if (outArchive instanceof IOutFeatureSetLevel) { ((IOutFeatureSetLevel)outArchive).setLevel(myLevel); } ... outArchive.close(); - use one of the
SevenZip.openOutArchiveXxx
Those methods provide implementations of the corresponding archive-format-specific interfaces. Those interfaces contain all supported configuration methods for the selected archive format. No cast orinstanceofcheck is needed in this case.
For example, the methodSevenZip.openOutArchive7z()returns an implementation of theIOutCreateArchive7zinterface with all configuration methods, supported by the 7z format, likeIOutFeatureSetLevel.setLevel(int).IOutCreateArchive7z outArchive7z = SevenZip.openOutArchive7z(); outArchive7z.setLevel(myLevel); ... outArchive7z.close();
Closeable.close() method.- Since:
- 9.20-2.00
- Author:
- Boris Brodski
-
Method Summary
Modifier and TypeMethodDescriptionvoidcreateArchive(ISequentialOutStream outStream, int numberOfItems, IOutCreateCallback<? extends T> outCreateCallback) Create new archive.Return the archive format of this out-archive instanceMethods inherited from interface net.sf.sevenzipjbinding.IOutArchiveBase
getTracePrintStream, isTrace, setTrace, setTracePrintStream
-
Method Details
-
createArchive
void createArchive(ISequentialOutStream outStream, int numberOfItems, IOutCreateCallback<? extends T> outCreateCallback) throws SevenZipException Create new archive. To update an existing archive open it first and then useIInArchive.getConnectedOutArchive()to get an instance of theIOutUpdateArchiveinterface.
TheoutCreateCallbackis designed to provide necessary information about new archive items and to receive information about the progress of the operation.
Note: some archive formats (like Zip) require an implementation of theIOutStreaminterface (instead of theISequentialOutStream) to be passed.- Parameters:
outStream- output stream to receive the new archive. An implementation of theIOutStreaminterface is required for some archive formats.numberOfItems- number of items in the new archiveoutCreateCallback- callback object to exchange information about the archive create operation.- Throws:
SevenZipException- 7-Zip or 7-Zip-JBinding error occurs. UseSevenZipException.printStackTraceExtended()to get stack traces of this SevenZipException and of all thrown 'caused by' exceptions.
-
getArchiveFormat
ArchiveFormat getArchiveFormat()Return the archive format of this out-archive instance- Returns:
- the archive format of this out-archive instance
-