Package net.sf.sevenzipjbinding.impl
Class OutArchiveImpl<T extends IOutItemBase>
java.lang.Object
net.sf.sevenzipjbinding.impl.OutArchiveImpl<T>
- Type Parameters:
T- the type of the item callback implementation
- All Implemented Interfaces:
Closeable,AutoCloseable,IOutArchive<T>,IOutArchiveBase,IOutCreateArchive<T>,IOutUpdateArchive<T>
- Direct Known Subclasses:
OutArchive7zImpl,OutArchiveBZip2Impl,OutArchiveGZipImpl,OutArchiveTarImpl,OutArchiveXzImpl,OutArchiveZipImpl
Common archive create and update class.
- Since:
- 9.20-2.00
- Author:
- Boris Brodski
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()voidcreateArchive(ISequentialOutStream outStream, int numberOfItems, IOutCreateCallback<? extends T> outCreateCallback) Create new archive.Return the archive format of this out-archive instanceGet connectedIInArchivefor update operations.AlternativePrintStreamfor trace output.booleanisTrace()Iftrue, print trace messages during compression and update operations to theSystem.outorIOutArchiveBase.getTracePrintStream().voidsetTrace(boolean trace) Iftrue, print trace messages during compression and update operations to theSystem.outorIOutArchiveBase.getTracePrintStream().voidsetTracePrintStream(PrintStream tracePrintStream) Set alternativePrintStreamfor trace output.voidupdateItems(ISequentialOutStream outStream, int numberOfItems, IOutCreateCallback<T> outUpdateCallback) Update items in archive (actually creating a new one based on the old one).
-
Constructor Details
-
OutArchiveImpl
public OutArchiveImpl()
-
-
Method Details
-
getArchiveFormat
Return the archive format of this out-archive instance- Specified by:
getArchiveFormatin interfaceIOutCreateArchive<T extends IOutItemBase>- Specified by:
getArchiveFormatin interfaceIOutUpdateArchive<T extends IOutItemBase>- Returns:
- the archive format of this out-archive instance
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
updateItems
public void updateItems(ISequentialOutStream outStream, int numberOfItems, IOutCreateCallback<T> outUpdateCallback) throws SevenZipException Update items in archive (actually creating a new one based on the old one).- Specified by:
updateItemsin interfaceIOutUpdateArchive<T extends IOutItemBase>- Parameters:
outStream- output stream to get the new archivenumberOfItems- number of items in the new archiveoutUpdateCallback- create call back object to provide more information for archive update 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.
-
createArchive
public 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.- Specified by:
createArchivein interfaceIOutCreateArchive<T extends IOutItemBase>- 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.
-
getConnectedInArchive
Get connectedIInArchivefor update operations.- Specified by:
getConnectedInArchivein interfaceIOutUpdateArchive<T extends IOutItemBase>- Returns:
- connected
IInArchivefor update operations
-
setTracePrintStream
Set alternativePrintStreamfor trace output. Default:System.out.- Specified by:
setTracePrintStreamin interfaceIOutArchiveBase- Parameters:
tracePrintStream- instance of thePrintStream.- See Also:
-
getTracePrintStream
AlternativePrintStreamfor trace output. Default:System.out.- Specified by:
getTracePrintStreamin interfaceIOutArchiveBase- Returns:
- Alternative
PrintStreamfor trace output - See Also:
-
setTrace
public void setTrace(boolean trace) Iftrue, print trace messages during compression and update operations to theSystem.outorIOutArchiveBase.getTracePrintStream(). Default:false- Specified by:
setTracein interfaceIOutArchiveBase- Parameters:
trace-true- output trace messages,false- be quiet.- See Also:
-
isTrace
public boolean isTrace()Iftrue, print trace messages during compression and update operations to theSystem.outorIOutArchiveBase.getTracePrintStream(). Default:false- Specified by:
isTracein interfaceIOutArchiveBase- Returns:
true- output trace messages,false- be quiet.- See Also:
-