net.sf.sevenzipjbinding
Interface ISevenZipInArchive

All Known Implementing Classes:
InArchiveImpl

public interface ISevenZipInArchive

One to one binding of original 7-Zip dll. Standard way to get implementation is to use SevenZip.

The interface provides functionality to query archive and archive item parameters and to extract archive items.

The last call should be a call of the method close(). After this call no more methods should be called.

Version:
4.65-1
Author:
Boris Brodski

Method Summary
 void close()
          Close archive.
 void extract(int[] indices, boolean testMode, IArchiveExtractCallback extractCallback)
          Extract archive items with indices indices.
Note: passing sorted indices array is more efficient.
 ExtractOperationResult extractSlow(int index, ISequentialOutStream outStream)
          Extract one item from archive.
 ExtractOperationResult extractSlow(int index, ISequentialOutStream outStream, java.lang.String password)
          Extract one item from archive.
 ArchiveFormat getArchiveFormat()
          Return archive format of the opened archive.
 java.lang.Object getArchiveProperty(PropID propID)
          Get value of archive property propID.
 PropertyInfo getArchivePropertyInfo(PropID propID)
          Get information about archive property propID.

Use PropID.getPropIDByIndex(int) to get PropID enumeration element with specified index.
 int getNumberOfArchiveProperties()
          Get count of properties of archive
 int getNumberOfItems()
          Returns count of items in archive.
 int getNumberOfProperties()
          Return count of properties of each archive item
 java.lang.Object getProperty(int index, PropID propID)
          Get value of property propID of the item with the index index.
 PropertyInfo getPropertyInfo(PropID propID)
          Get information about archive item property propID
 ISimpleInArchive getSimpleInterface()
          Return simple 7-Zip interface for the archive
 java.lang.String getStringArchiveProperty(PropID propID)
          Return property value in human readable form.
 java.lang.String getStringProperty(int index, PropID propID)
          Return property content in human readable form.
 

Method Detail

close

void close()
           throws SevenZipException
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.

Throws:
SevenZipException - 7-Zip or 7-Zip-JBinding intern error. Check exception message for more information.

getNumberOfItems

int getNumberOfItems()
                     throws SevenZipException
Returns count of items in archive. Depending on archive type directories are considered to be items or not.

Returns:
count of items in archive
Throws:
SevenZipException - 7-Zip or 7-Zip-JBinding intern error. Check exception message for more information.

getProperty

java.lang.Object getProperty(int index,
                             PropID propID)
                             throws SevenZipException
Get value of property propID of the item with the index index.

Parameters:
index - index of item to get property value
propID - property to get value of
Returns:
value of property propID of item with index index
Throws:
SevenZipException - 7-Zip or 7-Zip-JBinding intern error. Check exception message for more information.

getStringProperty

java.lang.String getStringProperty(int index,
                                   PropID propID)
                                   throws SevenZipException
Return property content in human readable form. Example for PropID.ATTRIBUTES: D for a directory.

Parameters:
index - index of item in archive to get property of
propID - property to return
Returns:
property propID of item with id index in human readable form.
Throws:
SevenZipException - 7-Zip or 7-Zip-JBinding intern error. Check exception message for more information.

extract

void extract(int[] indices,
             boolean testMode,
             IArchiveExtractCallback extractCallback)
             throws SevenZipException
Extract archive items with indices indices.
Note: passing sorted indices array is more efficient. But it isn't suggested to manually sort indices with something like Arrays.sort(int[]). Sort indices only, if you can do it quicker, that generic sort algorithms: O(n*log(n)).

Parameters:
indices - (optional) array of indices of archive items to extract.
null - all archive items.
testMode - true - test archive items only
false - extract archive items
extractCallback - extraction callback object. Optional implementation of ICryptoGetTextPassword.
Throws:
SevenZipException - 7-Zip or 7-Zip-JBinding intern error. Check exception message for more information.

extractSlow

ExtractOperationResult extractSlow(int index,
                                   ISequentialOutStream outStream)
                                   throws SevenZipException
Extract one item from archive. Multiple calls of this method are inefficient for some archive types.

Parameters:
index - index of the item to extract
outStream - sequential output stream to get content of the item
Returns:
result status of the extraction
Throws:
SevenZipException - 7-Zip or 7-Zip-JBinding intern error. Check exception message for more information.

extractSlow

ExtractOperationResult extractSlow(int index,
                                   ISequentialOutStream outStream,
                                   java.lang.String password)
                                   throws SevenZipException
Extract one item from archive. Multiple calls of this method are inefficient for some archive types.

Parameters:
index - index of the item to extract
outStream - sequential output stream to get content of the item
password - password to use
Returns:
result status of the extraction
Throws:
SevenZipException - 7-Zip or 7-Zip-JBinding intern error. Check exception message for more information.

getArchiveProperty

java.lang.Object getArchiveProperty(PropID propID)
                                    throws SevenZipException
Get value of archive property propID.

Parameters:
propID - property to get value of
Returns:
value of archive property propID
Throws:
SevenZipException - 7-Zip or 7-Zip-JBinding intern error. Check exception message for more information.

getStringArchiveProperty

java.lang.String getStringArchiveProperty(PropID propID)
                                          throws SevenZipException
Return property value in human readable form.

Parameters:
propID - property to return
Returns:
property propID of archive in human readable form.
Throws:
SevenZipException - 7-Zip or 7-Zip-JBinding intern error. Check exception message for more information.

getNumberOfProperties

int getNumberOfProperties()
                          throws SevenZipException
Return count of properties of each archive item

Returns:
count of properties of each archive item
Throws:
SevenZipException - 7-Zip or 7-Zip-JBinding intern error. Check exception message for more information.

getPropertyInfo

PropertyInfo getPropertyInfo(PropID propID)
                             throws SevenZipException
Get information about archive item property propID

Parameters:
propID - item property
Returns:
information about property of archive item
Throws:
SevenZipException - 7-Zip or 7-Zip-JBinding intern error. Check exception message for more information.

getNumberOfArchiveProperties

int getNumberOfArchiveProperties()
                                 throws SevenZipException
Get count of properties of archive

Returns:
count of properties of archive
Throws:
SevenZipException - 7-Zip or 7-Zip-JBinding intern error. Check exception message for more information.

getArchivePropertyInfo

PropertyInfo getArchivePropertyInfo(PropID propID)
                                    throws SevenZipException
Get information about archive property propID.

Use PropID.getPropIDByIndex(int) to get PropID enumeration element with specified index.

Parameters:
propID - archive property
Returns:
information about archive property
Throws:
SevenZipException - 7-Zip or 7-Zip-JBinding intern error. Check exception message for more information.

getSimpleInterface

ISimpleInArchive getSimpleInterface()
Return simple 7-Zip interface for the archive

Returns:
simple 7-Zip interface for the archive

getArchiveFormat

ArchiveFormat getArchiveFormat()
Return archive format of the opened archive.

Returns:
archive format of the opened archive