Class WimArchive
- java.lang.Object
-
- com.aspose.zip.WimArchive
-
- All Implemented Interfaces:
IArchive,AutoCloseable
public class WimArchive extends Object implements IArchive, AutoCloseable
This class represents a wim archive file.
-
-
Constructor Summary
Constructors Constructor Description WimArchive(InputStream sourceStream)Initializes a new instance of theWimArchiveclass and composes an entry list can be extracted from the archive.WimArchive(InputStream sourceStream, WimLoadOptions loadOptions)Initializes a new instance of theWimArchiveclass and composes an entry list can be extracted from the archive.WimArchive(String path)Initializes a new instance of theWimArchiveclass and composes an entry list can be extracted from the archive.WimArchive(String path, WimLoadOptions loadOptions)Initializes a new instance of theWimArchiveclass and composes an entry list can be extracted from the archive.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()voidextractToDirectory(String destinationDirectory)Extracts the archive to the file by path.intgetBootImageIndex()Gets the (zero-based) index of the bootable image.Iterable<IArchiveFileEntry>getFileEntries()Gets entries ofIArchiveFileEntrytype constituting the wim archive.intgetFileFormatVersion()Gets the version of the file format.ArchiveFormatgetFormat()Gets the archive format.UUIDgetGuid()Gets the identifying UUID for the archive.List<WimImage>getImages()Gets entries ofWimImagetype constituting the archive.StringgetManifest()Gets the embedded manifest describing the file and the contained images.
-
-
-
Constructor Detail
-
WimArchive
public WimArchive(InputStream sourceStream)
Initializes a new instance of the
WimArchiveclass and composes an entry list can be extracted from the archive.The following example shows how to extract all of the entries to a directory.
try (WimArchive archive = new WimArchive(new FileInputStream("archive.wim"))) { archive.getImages().get_Item(0).extractToDirectory("C:\\extracted"); } catch (IOException ex) { }This constructor does not unpack any entry. See
WimFileEntry.open()method for unpacking.- Parameters:
sourceStream- the source of the archive- Throws:
com.aspose.ms.System.ArgumentNullException-sourceStreamis null.com.aspose.ms.System.IO.InvalidDataException-sourceStreamis not valid wim archive.
-
WimArchive
public WimArchive(InputStream sourceStream, WimLoadOptions loadOptions)
Initializes a new instance of the
WimArchiveclass and composes an entry list can be extracted from the archive.The following example shows how to extract all of the entries to a directory.
try (WimArchive archive = new WimArchive(new FileInputStream("archive.wim"))) { archive.getImages().get_Item(0).extractToDirectory("C:\\extracted"); } catch (IOException ex) { }This constructor does not unpack any entry. See
WimFileEntry.open()method for unpacking.- Parameters:
sourceStream- the source of the archiveloadOptions- Options to load existing archive with.- Throws:
com.aspose.ms.System.ArgumentNullException-sourceStreamis null.com.aspose.ms.System.IO.InvalidDataException-sourceStreamis not valid wim archive.
-
WimArchive
public WimArchive(String path)
Initializes a new instance of the
WimArchiveclass and composes an entry list can be extracted from the archive.The following example shows how to extract all of the entries to a directory.
try (WimArchive archive = new WimArchive("archive.wim")) { archive.getImages().get_Item(0).extractToDirectory("C:\\extracted"); }This constructor does not unpack any entry. See
WimFileEntry.open()method for unpacking.- Parameters:
path- the path to the archive file- Throws:
com.aspose.ms.System.ArgumentNullException-pathis null.com.aspose.ms.System.SecurityException- The caller does not have the required permission to access.com.aspose.ms.System.ArgumentException- Thepathis empty, contains only white spaces, or contains invalid characters.com.aspose.ms.System.IO.PathTooLongException- The specifiedpath, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters, and file names must be less than 260 characters.com.aspose.ms.System.NotSupportedException- File atpathcontains a colon (:) in the middle of the string.com.aspose.ms.System.IO.FileNotFoundException- The file is not found.com.aspose.ms.System.IO.DirectoryNotFoundException- The specified path is invalid, such as being on an unmapped drive.com.aspose.ms.System.IO.IOException- The file is already open.
-
WimArchive
public WimArchive(String path, WimLoadOptions loadOptions)
Initializes a new instance of the
WimArchiveclass and composes an entry list can be extracted from the archive.The following example shows how to extract all of the entries to a directory.
try (WimArchive archive = new WimArchive("archive.wim")) { archive.getImages().get_Item(0).extractToDirectory("C:\\extracted"); }This constructor does not unpack any entry. See
WimFileEntry.open()method for unpacking.- Parameters:
path- the path to the archive fileloadOptions- Options to load existing archive with.- Throws:
com.aspose.ms.System.ArgumentNullException-pathis null.com.aspose.ms.System.SecurityException- The caller does not have the required permission to access.com.aspose.ms.System.ArgumentException- Thepathis empty, contains only white spaces, or contains invalid characters.com.aspose.ms.System.IO.PathTooLongException- The specifiedpath, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters, and file names must be less than 260 characters.com.aspose.ms.System.NotSupportedException- File atpathcontains a colon (:) in the middle of the string.com.aspose.ms.System.IO.FileNotFoundException- The file is not found.com.aspose.ms.System.IO.DirectoryNotFoundException- The specified path is invalid, such as being on an unmapped drive.com.aspose.ms.System.IO.IOException- The file is already open.
-
-
Method Detail
-
getImages
public final List<WimImage> getImages()
Gets entries of
WimImagetype constituting the archive.- Returns:
- entries of
WimImagetype constituting the archive
-
getFileEntries
public final Iterable<IArchiveFileEntry> getFileEntries()
Gets entries of
IArchiveFileEntrytype constituting the wim archive.- Specified by:
getFileEntriesin interfaceIArchive- Returns:
- entries of
IArchiveFileEntrytype constituting the wim archive
-
getFormat
public final ArchiveFormat getFormat()
Gets the archive format.
-
getGuid
public final UUID getGuid()
Gets the identifying UUID for the archive.
- Returns:
- the identifying UUID for the archive
-
getBootImageIndex
public final int getBootImageIndex()
Gets the (zero-based) index of the bootable image.
- Returns:
- the (zero-based) index of the bootable image
-
getFileFormatVersion
public final int getFileFormatVersion()
Gets the version of the file format.
- Returns:
- the version of the file format
-
getManifest
public final String getManifest()
Gets the embedded manifest describing the file and the contained images.
- Returns:
- the embedded manifest describing the file and the contained images
-
extractToDirectory
public final void extractToDirectory(String destinationDirectory)
Extracts the archive to the file by path.
- Specified by:
extractToDirectoryin interfaceIArchive- Parameters:
destinationDirectory- the path to the directory to place the extracted files in- Throws:
com.aspose.ms.System.ArgumentNullException- path is nullcom.aspose.ms.System.IO.PathTooLongException- The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters and file names must be less than 260 characters.com.aspose.ms.System.SecurityException- The caller does not have the required permission to access the existing directory.com.aspose.ms.System.NotSupportedException- If the directory does not exist, the path contains a colon character (:) that is not part of a drive label ("C:\").com.aspose.ms.System.ArgumentException- path is a zero-length string, contains only white space, or contains one or more invalid characters.com.aspose.ms.System.IO.IOException- The directory specified by path is a file. -or- The network name is not known.com.aspose.ms.System.IO.InvalidDataException- The archive is corrupted.
-
close
public void close()
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceIArchive
-
-