CabArchive

Inheritance: java.lang.Object, com.aspose.zip.ILicenseStateProvider

All Implemented Interfaces: com.aspose.zip.IArchive, java.lang.AutoCloseable

public class CabArchive extends ILicenseStateProvider implements IArchive, AutoCloseable

This class represents cab archive file.

Constructors

ConstructorDescription
CabArchive(InputStream sourceStream)Initializes a new instance of the CabArchive class and composes entries list can be extracted from the archive.
CabArchive(String path)Initializes a new instance of the CabArchive class and composes entries list can be extracted from the archive.

Methods

MethodDescription
close(){@inheritDoc}
dispose()Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
extractToDirectory(String destinationDirectory)Extracts all the files in the archive to the directory provided.
getEntries()Gets entries of CabEntry type constituting the archive.
getFileEntries()Gets entries of IArchiveFileEntry type constituting the cab archive.

CabArchive(InputStream sourceStream)

public CabArchive(InputStream sourceStream)

Initializes a new instance of the CabArchive class and composes entries list can be extracted from the archive.

The following example shows how to extract all of the entries to a directory.


     try (CabArchive archive = new CabArchive(new FileInputStream("archive.cab"))) {
         archive.extractToDirectory("C:\\extracted");
     } catch (IOException ex) {
     }
 

This constructor does not unpack any entry. See CabEntry.open() method for unpacking.

Parameters:

ParameterTypeDescription
sourceStreamjava.io.InputStreamthe source of the archive

CabArchive(String path)

public CabArchive(String path)

Initializes a new instance of the CabArchive class and composes entries list can be extracted from the archive.

The following example shows how to extract all of the entries to a directory.


     try (CabArchive archive = new CabArchive("archive.cab")) {
         archive.extractToDirectory("C:\\extracted");
     } catch (IOException ex) {
     }
 

This constructor does not unpack any entry. See CabEntry.open() method for unpacking.

Parameters:

ParameterTypeDescription
pathjava.lang.Stringthe path to the archive file

close()

public void close()

dispose()

public final void dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

extractToDirectory(String destinationDirectory)

public final void extractToDirectory(String destinationDirectory)

Extracts all the files in the archive to the directory provided.


     try (CabArchive archive = new CabArchive("archive.cab")) {
         archive.extractToDirectory("C:\\extracted");
     } catch (IOException ex) {
     }
 

Parameters:

ParameterTypeDescription
destinationDirectoryjava.lang.Stringthe path to the directory to place the extracted files in.

If the directory does not exist, it will be created |

getEntries()

public final List<CabEntry> getEntries()

Gets entries of CabEntry type constituting the archive.

Returns: java.util.List<com.aspose.zip.CabEntry> - entries of CabEntry type constituting the archive

getFileEntries()

public final Iterable<IArchiveFileEntry> getFileEntries()

Gets entries of IArchiveFileEntry type constituting the cab archive.

Returns: java.lang.Iterable<com.aspose.zip.IArchiveFileEntry> - entries of IArchiveFileEntry type constituting the cab archive