Package net.sf.sevenzipjbinding.impl
Class InArchiveImpl
java.lang.Object
net.sf.sevenzipjbinding.impl.InArchiveImpl
- All Implemented Interfaces:
Closeable,AutoCloseable,IInArchive
Implementation of
IInArchive.- Since:
- 4.65-1
- Author:
- Boris Brodski
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Close archive.voidextract(int[] indices, boolean testMode, IArchiveExtractCallback extractCallback) Extract archive items with indicesindices.extractSlow(int index, ISequentialOutStream outStream) Extract one item from archive.extractSlow(int index, ISequentialOutStream outStream, String password) Extract one item from archive.Return archive format of the opened archive.getArchiveProperty(PropID propID) Get value of archive propertypropID.getArchivePropertyInfo(int index) Get information about archive property with indexindex.Get an instance ofIOutUpdateArchiveconnected to the current archive.Get an instance ofIOutUpdateArchive7zconnected to the current archive.Get an instance ofIOutUpdateArchiveBZip2connected to the current archive.Get an instance ofIOutUpdateArchiveGZipconnected to the current archive.Get an instance ofIOutUpdateArchiveTarconnected to the current archive.Get an instance ofIOutUpdateArchiveXzconnected to the current archive.Get an instance ofIOutUpdateArchiveZipconnected to the current archive.intGet count of properties of archiveintReturns count of items in archive.intReturn count of properties of each archive itemgetProperty(int index, PropID propID) Get value of propertypropIDof the item with the indexindex.
NOTE: Some properties may only be available after the extraction operation completes.
Example: PACKED_SIZE of the LZMA archives.getPropertyInfo(int index) Get information about archive item property with indexindex.Return simple 7-Zip interface for the archivegetStringArchiveProperty(PropID propID) Return property value in human readable form.getStringProperty(int index, PropID propID) Return property content in human readable form.
-
Constructor Details
-
InArchiveImpl
public InArchiveImpl()
-
-
Method Details
-
extract
public void extract(int[] indices, boolean testMode, IArchiveExtractCallback extractCallback) throws SevenZipException Extract archive items with indicesindices.
Note: passing a sortedindicesarray is more efficient. However, it is not recommended to manually sort the indices with something likeArrays.sort(int[])unless you can do it faster than a generic sort algorithm:O(n*log(n)).- Specified by:
extractin interfaceIInArchive- Parameters:
indices- (optional) array of indices of archive items to extract.
null- all archive items.testMode-true- test archive items only
false- extract archive itemsextractCallback- extraction callback object. Optional implementation ofICryptoGetTextPassword.- 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.
-
extractSlow
public ExtractOperationResult extractSlow(int index, ISequentialOutStream outStream) throws SevenZipException Extract one item from archive. Multiple calls of this method are inefficient for some archive types.- Specified by:
extractSlowin interfaceIInArchive- Parameters:
index- index of the item to extract. 0 - first archive item.outStream- sequential output stream to get content of the item- Returns:
- result status of the extraction
- 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.
-
extractSlow
public ExtractOperationResult extractSlow(int index, ISequentialOutStream outStream, String password) throws SevenZipException Extract one item from archive. Multiple calls of this method are inefficient for some archive types.- Specified by:
extractSlowin interfaceIInArchive- Parameters:
index- index of the item to extract. 0 - first archive item.outStream- sequential output stream to get content of the itempassword- password to use- Returns:
- result status of the extraction
- 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.
-
getArchiveProperty
Get value of archive propertypropID.- Specified by:
getArchivePropertyin interfaceIInArchive- Parameters:
propID- property to get value of- Returns:
- value of archive property
propID - 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.
-
getStringArchiveProperty
Return property value in human readable form.- Specified by:
getStringArchivePropertyin interfaceIInArchive- Parameters:
propID- property to return- Returns:
- property
propIDof archive in human readable form. - 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.
-
getArchivePropertyInfo
Get information about archive property with indexindex.- Specified by:
getArchivePropertyInfoin interfaceIInArchive- Parameters:
index- property index- Returns:
- information about archive property
- 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.- See Also:
-
getNumberOfArchiveProperties
Get count of properties of archive- Specified by:
getNumberOfArchivePropertiesin interfaceIInArchive- Returns:
- count of properties of archive
- 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.
-
getNumberOfProperties
Return count of properties of each archive item- Specified by:
getNumberOfPropertiesin interfaceIInArchive- Returns:
- count of properties of each archive item
- 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.
-
getPropertyInfo
Get information about archive item property with indexindex.- Specified by:
getPropertyInfoin interfaceIInArchive- Parameters:
index- property index- Returns:
- information about property of archive item
- 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.- See Also:
-
close
Close archive. This method should be the last one called on the implementation of this interface. After this call no more methods should be called.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceIInArchive- 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.
-
getNumberOfItems
Returns count of items in archive. Depending on archive type directories are considered to be items or not.- Specified by:
getNumberOfItemsin interfaceIInArchive- Returns:
- count of items in archive
- 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.
-
getProperty
Get value of propertypropIDof the item with the indexindex.
NOTE: Some properties may only be available after the extraction operation completes.
Example: PACKED_SIZE of the LZMA archives.- Specified by:
getPropertyin interfaceIInArchive- Parameters:
index- index of item to get property value. 0 - first archive item.propID- property to get value of- Returns:
- value of property
propIDof item with indexindex - 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.
-
getStringProperty
Return property content in human readable form. Example forPropID.ATTRIBUTES:Dfor a directory.- Specified by:
getStringPropertyin interfaceIInArchive- Parameters:
index- index of item in archive to get property of. 0 - first archive item.propID- property to return- Returns:
- property
propIDof item with idindexin human readable form. - 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.
-
getSimpleInterface
Return simple 7-Zip interface for the archive- Specified by:
getSimpleInterfacein interfaceIInArchive- Returns:
- simple 7-Zip interface for the archive
-
getArchiveFormat
Return archive format of the opened archive.- Specified by:
getArchiveFormatin interfaceIInArchive- Returns:
- archive format of the opened archive
-
getConnectedOutArchive
Get an instance ofIOutUpdateArchiveconnected to the current archive. This is a part of the archive-format-independent API. The new instance allows modification of the currently opened archive. Multiple calls of this method return the same instance. Closing the returned instance ofIOutUpdateArchiveisn't necessary, since it will be closed automatically. This happens when the parent instance of theIInArchivegets closed. Calls to theCloseable.close()methods of such connected instances will be ignored.- Specified by:
getConnectedOutArchivein interfaceIInArchive- Returns:
- an instance of the
IOutUpdateArchiveinterface - 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.
-
getConnectedOutArchive7z
Get an instance ofIOutUpdateArchive7zconnected to the current archive. This is a part of the archive-format-specific API. The new instance only allows modification of the currently opened 7z archive. Multiple calls of this method return the same instance. Closing the returned instance ofIOutUpdateArchive7zisn't necessary, since it will be closed automatically. This happens when the parent instance of theIInArchivegets closed. Calls to theCloseable.close()methods of such connected instances will be ignored.- Specified by:
getConnectedOutArchive7zin interfaceIInArchive- Returns:
- an instance of the
IOutUpdateArchiveinterface - 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.
-
getConnectedOutArchiveZip
Get an instance ofIOutUpdateArchiveZipconnected to the current archive. This is a part of the archive-format-specific API. The new instance only allows modification of the currently opened Zip archive. Multiple calls of this method return the same instance. Closing the returned instance ofIOutUpdateArchiveZipisn't necessary, since it will be closed automatically. This happens when the parent instance of theIInArchivegets closed. Calls to theCloseable.close()methods of such connected instances will be ignored.- Specified by:
getConnectedOutArchiveZipin interfaceIInArchive- Returns:
- an instance of the
IOutUpdateArchiveinterface - 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.
-
getConnectedOutArchiveTar
Get an instance ofIOutUpdateArchiveTarconnected to the current archive. This is a part of the archive-format-specific API. The new instance only allows modification of the currently opened Tar archive. Multiple calls of this method return the same instance. Closing the returned instance ofIOutUpdateArchiveTarisn't necessary, since it will be closed automatically. This happens when the parent instance of theIInArchivegets closed. Calls to theCloseable.close()methods of such connected instances will be ignored.- Specified by:
getConnectedOutArchiveTarin interfaceIInArchive- Returns:
- an instance of the
IOutUpdateArchiveinterface - 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.
-
getConnectedOutArchiveGZip
Get an instance ofIOutUpdateArchiveGZipconnected to the current archive. This is a part of the archive-format-specific API. The new instance only allows modification of the currently opened GZip archive. Multiple calls of this method return the same instance. Closing the returned instance ofIOutUpdateArchiveGZipisn't necessary, since it will be closed automatically. This happens when the parent instance of theIInArchivegets closed. Calls to theCloseable.close()methods of such connected instances will be ignored.- Specified by:
getConnectedOutArchiveGZipin interfaceIInArchive- Returns:
- an instance of the
IOutUpdateArchiveinterface - 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.
-
getConnectedOutArchiveBZip2
Get an instance ofIOutUpdateArchiveBZip2connected to the current archive. This is a part of the archive-format-specific API. The new instance only allows modification of the currently opened BZip2 archive. Multiple calls of this method return the same instance. Closing the returned instance ofIOutUpdateArchiveBZip2isn't necessary, since it will be closed automatically. This happens when the parent instance of theIInArchivegets closed. Calls to theCloseable.close()methods of such connected instances will be ignored.- Specified by:
getConnectedOutArchiveBZip2in interfaceIInArchive- Returns:
- an instance of the
IOutUpdateArchiveinterface - 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.
-
getConnectedOutArchiveXz
Get an instance ofIOutUpdateArchiveXzconnected to the current archive. This is a part of the archive-format-specific API. The new instance only allows modification of the currently opened Xz archive. Multiple calls of this method return the same instance. Closing the returned instance ofIOutUpdateArchiveXzisn't necessary, since it will be closed automatically. This happens when the parent instance of theIInArchivegets closed. Calls to theCloseable.close()methods of such connected instances will be ignored.- Specified by:
getConnectedOutArchiveXzin interfaceIInArchive- Returns:
- an instance of the
IOutUpdateArchiveinterface - 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.
-