IsoArchive

Inheritance: java.lang.Object

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

public final class IsoArchive implements IArchive, AutoCloseable

Represents an ISO archive (ISO 9660).

Constructors

ConstructorDescription
IsoArchive()Initializes a new instance of the IsoArchive class and creates an empty ISO archive for adding new files and directories.
IsoArchive(InputStream sourceStream)Initializes a new instance of the IsoArchive class and composes entries list that can be extracted from the archive.
IsoArchive(InputStream sourceStream, IsoLoadOptions loadOptions)Initializes a new instance of the IsoArchive class and composes entries list that can be extracted from the archive.
IsoArchive(String path)Initializes a new instance of the IsoArchive class and composes entries list that can be extracted from the archive.
IsoArchive(String path, IsoLoadOptions loadOptions)Initializes a new instance of the IsoArchive class and composes entries list that can be extracted from the archive.

Methods

MethodDescription
close(){@inheritDoc}
createDirectory(String name)Adds a directory to the ISO image.
createEntry(String name)Adds a file to the ISO image.
createEntry(String name, InputStream source)Adds a file to the ISO image.
createEntry(String name, String filePath)Adds a file to the ISO image.
extractToDirectory(String destinationDirectory)Extracts all entries to the specified directory.
getEntries()Gets entries of IsoEntry type constituting the archive.
getFileEntries()Gets entries of IArchiveFileEntry type constituting the archive.
save(OutputStream stream)Saves the ISO image to the specified stream.
save(OutputStream stream, IsoSaveOptions saveOptions)Saves the ISO image to the specified stream.
save(String path)Saves the ISO image to the specified path.
save(String path, IsoSaveOptions saveOptions)Saves the ISO image to the specified path.

IsoArchive()

public IsoArchive()

Initializes a new instance of the IsoArchive class and creates an empty ISO archive for adding new files and directories.

The following example shows how to create a new empty ISO archive and add files to it:


     // Create a new empty ISO archive
     try (IsoArchive isoArchive = new IsoArchive()) {
         // Add files to the ISO archive
         isoArchive.createEntry("example_file.txt", "path_to_file.txt");
         // Save the ISO archive to a file
         isoArchive.save("new_archive.iso");
     }
 

IsoArchive(InputStream sourceStream)

public IsoArchive(InputStream sourceStream)

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

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


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

This constructor does not unpack any entry.

Parameters:

ParameterTypeDescription
sourceStreamjava.io.InputStreamthe source of the archive

IsoArchive(InputStream sourceStream, IsoLoadOptions loadOptions)

public IsoArchive(InputStream sourceStream, IsoLoadOptions loadOptions)

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

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


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

This constructor does not unpack any entry.

Parameters:

ParameterTypeDescription
sourceStreamjava.io.InputStreamthe source of the archive
loadOptionsIsoLoadOptionsthe options to load archive with

IsoArchive(String path)

public IsoArchive(String path)

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

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


     try (IsoArchive archive = new IsoArchive("archive.iso")) {
         archive.extractToDirectory("C:\\extracted");
     }
 

This constructor does not unpack any entry.

Parameters:

ParameterTypeDescription
pathjava.lang.Stringthe path to the archive file

IsoArchive(String path, IsoLoadOptions loadOptions)

public IsoArchive(String path, IsoLoadOptions loadOptions)

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

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


     try (IsoArchive archive = new IsoArchive("archive.iso")) {
         archive.extractToDirectory("C:\\extracted");
     }
 

This constructor does not unpack any entry.

Parameters:

ParameterTypeDescription
pathjava.lang.Stringthe path to the archive file
loadOptionsIsoLoadOptionsthe options to load archive with

close()

public void close()

createDirectory(String name)

public final IsoEntry createDirectory(String name)

Adds a directory to the ISO image.

Parameters:

ParameterTypeDescription
namejava.lang.Stringthe path of the directory in the ISO

Returns: IsoEntry - the ISO entry composed

createEntry(String name)

public final IsoEntry createEntry(String name)

Adds a file to the ISO image.

Parameters:

ParameterTypeDescription
namejava.lang.Stringthe path of the file in the ISO

Returns: IsoEntry - the ISO entry composed

createEntry(String name, InputStream source)

public final IsoEntry createEntry(String name, InputStream source)

Adds a file to the ISO image.

Parameters:

ParameterTypeDescription
namejava.lang.Stringthe path of the file in the ISO
sourcejava.io.InputStreamthe stream containing the file data

Returns: IsoEntry - the ISO entry composed

createEntry(String name, String filePath)

public final IsoEntry createEntry(String name, String filePath)

Adds a file to the ISO image.

Parameters:

ParameterTypeDescription
namejava.lang.Stringthe path of the file in the ISO
filePathjava.lang.Stringthe path of the file

Returns: IsoEntry - the ISO entry composed

extractToDirectory(String destinationDirectory)

public final void extractToDirectory(String destinationDirectory)

Extracts all entries to the specified directory.

The following example shows how to extract all entries to a directory:


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

Parameters:

ParameterTypeDescription
destinationDirectoryjava.lang.Stringthe directory to extract the entries to

getEntries()

public final List<IsoEntry> getEntries()

Gets entries of IsoEntry type constituting the archive.

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

getFileEntries()

public final Iterable<IArchiveFileEntry> getFileEntries()

Gets entries of IArchiveFileEntry type constituting the archive.

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

save(OutputStream stream)

public final void save(OutputStream stream)

Saves the ISO image to the specified stream.

The following example shows how to save an ISO archive to a memory stream:


     ByteArrayOutputStream memoryStream = new ByteArrayOutputStream();
     // Create a new empty ISO archive
     try (IsoArchive isoArchive = new IsoArchive()) {
         // Add files to the ISO archive
         isoArchive.createEntry("example_file.txt", "path_to_file.txt");
         // Save the ISO archive to a memory stream
         isoArchive.save(memoryStream);
     }
 

Parameters:

ParameterTypeDescription
streamjava.io.OutputStreamthe stream where the ISO image will be saved

save(OutputStream stream, IsoSaveOptions saveOptions)

public final void save(OutputStream stream, IsoSaveOptions saveOptions)

Saves the ISO image to the specified stream.

The following example shows how to save an ISO archive to a memory stream:


     ByteArrayOutputStream memoryStream = new ByteArrayOutputStream();
     // Create a new empty ISO archive
     try (IsoArchive isoArchive = new IsoArchive()) {
         // Add files to the ISO archive
         isoArchive.createEntry("example_file.txt", "path_to_file.txt");
         // Save the ISO archive to a memory stream
         isoArchive.save(memoryStream);
     }
 

Parameters:

ParameterTypeDescription
streamjava.io.OutputStreamthe stream where the ISO image will be saved
saveOptionsIsoSaveOptionsthe options to save ISO archive with

save(String path)

public final void save(String path)

Saves the ISO image to the specified path.

The following example shows how to save an ISO archive to a file:


     // Create a new empty ISO archive
     try (IsoArchive isoArchive = new IsoArchive()) {
         // Add files to the ISO archive
         isoArchive.createEntry("example_file.txt", "path_to_file.txt");
         // Save the ISO archive to a file
         isoArchive.save("new_archive.iso");
     }
 

Parameters:

ParameterTypeDescription
pathjava.lang.Stringthe path where the ISO image will be saved

save(String path, IsoSaveOptions saveOptions)

public final void save(String path, IsoSaveOptions saveOptions)

Saves the ISO image to the specified path.

The following example shows how to save an ISO archive to a file:


     // Create a new empty ISO archive
     try (IsoArchive isoArchive = new IsoArchive()) {
         // Add files to the ISO archive
         isoArchive.createEntry("example_file.txt", "path_to_file.txt");
         // Save the ISO archive to a file
         isoArchive.save("new_archive.iso");
     }
 

Parameters:

ParameterTypeDescription
pathjava.lang.Stringthe path where the ISO image will be saved
saveOptionsIsoSaveOptionsthe options to save ISO archive with