AppleArchive

Inheritance: java.lang.Object

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

public class AppleArchive implements IArchive, AutoCloseable

This class represents an Apple Archive (.aar) file. Use it to compose Apple Archive files.

Apple and Apple Archive are trademarks of Apple Inc.

Constructors

ConstructorDescription
AppleArchive()Initializes a new instance of the AppleArchive class with settings used for composed entries.
AppleArchive(AppleArchiveEntrySettings newEntrySettings)Initializes a new instance of the AppleArchive class with settings used for composed entries.
AppleArchive(InputStream sourceStream)Initializes a new instance of the AppleArchive class and composes an entry list can be extracted from the archive.
AppleArchive(InputStream sourceStream, AppleArchiveLoadOptions loadOptions)Initializes a new instance of the AppleArchive class and composes an entry list can be extracted from the archive.
AppleArchive(String path)Initializes a new instance of the AppleArchive class and composes an entry list can be extracted from the archive.
AppleArchive(String path, AppleArchiveLoadOptions loadOptions)Initializes a new instance of the AppleArchive class and composes an entry list can be extracted from the archive.

Methods

MethodDescription
close(){@inheritDoc}
createEntries(File directory)Adds to the archive all files and directories recursively in the directory given.
createEntries(File directory, boolean includeRootDirectory)Adds to the archive all files and directories recursively in the directory given.
createEntry(String name, File fileInfo)Creates a single entry within the archive.
createEntry(String name, File fileInfo, boolean openImmediately)Creates a single entry within the archive.
createEntry(String name, InputStream source)Creates a single entry within the archive.
createEntry(String name, String path)Creates a single entry within the archive.
createEntry(String name, String path, boolean openImmediately)Creates a single entry within the archive.
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 constituting the archive.
getFileEntries()Gets entries of IArchiveFileEntry type constituting the archive.
getFormat()Gets the archive format.
getNewEntrySettings()Gets settings used for newly composed entries.
isSolid()Gets a value indicating whether the archive uses solid compression.
save(OutputStream output)Saves archive to the stream provided.
save(String destinationFileName)Saves archive to a destination file provided.

AppleArchive()

public AppleArchive()

Initializes a new instance of the AppleArchive class with settings used for composed entries.

AppleArchive(AppleArchiveEntrySettings newEntrySettings)

public AppleArchive(AppleArchiveEntrySettings newEntrySettings)

Initializes a new instance of the AppleArchive class with settings used for composed entries.

Parameters:

ParameterTypeDescription
newEntrySettingsAppleArchiveEntrySettingsSettings used when composing a new Apple Archive.

AppleArchive(InputStream sourceStream)

public AppleArchive(InputStream sourceStream)

Initializes a new instance of the AppleArchive class and composes an entry list can be extracted from the archive.

Parameters:

ParameterTypeDescription
sourceStreamjava.io.InputStreamThe source of the archive.

This constructor does not decompress any entry. See extractToDirectory(String) and AppleArchiveEntry.open() methods for decompressing. |

AppleArchive(InputStream sourceStream, AppleArchiveLoadOptions loadOptions)

public AppleArchive(InputStream sourceStream, AppleArchiveLoadOptions loadOptions)

Initializes a new instance of the AppleArchive class and composes an entry list can be extracted from the archive.

Parameters:

ParameterTypeDescription
sourceStreamjava.io.InputStreamThe source of the archive.
loadOptionsAppleArchiveLoadOptionsOptions to load existing archive with.

This constructor does not decompress any entry. See extractToDirectory(String) and AppleArchiveEntry.open() methods for decompressing. |

AppleArchive(String path)

public AppleArchive(String path)

Initializes a new instance of the AppleArchive class and composes an entry list can be extracted from the archive.

Parameters:

ParameterTypeDescription
pathjava.lang.StringThe fully qualified or the relative path to the archive file.

This constructor does not decompress any entry. See extractToDirectory(String) and AppleArchiveEntry.open() methods for decompressing. |

AppleArchive(String path, AppleArchiveLoadOptions loadOptions)

public AppleArchive(String path, AppleArchiveLoadOptions loadOptions)

Initializes a new instance of the AppleArchive class and composes an entry list can be extracted from the archive.

Parameters:

ParameterTypeDescription
pathjava.lang.StringThe fully qualified or the relative path to the archive file.
loadOptionsAppleArchiveLoadOptionsOptions to load existing archive with.

This constructor does not decompress any entry. See extractToDirectory(String) and AppleArchiveEntry.open() methods for decompressing. |

close()

public void close()

createEntries(File directory)

public final AppleArchive createEntries(File directory)

Adds to the archive all files and directories recursively in the directory given.

Parameters:

ParameterTypeDescription
directoryjava.io.FileDirectory to compress.

Returns: AppleArchive - The archive with entries composed.

createEntries(File directory, boolean includeRootDirectory)

public final AppleArchive createEntries(File directory, boolean includeRootDirectory)

Adds to the archive all files and directories recursively in the directory given.

Parameters:

ParameterTypeDescription
directoryjava.io.FileDirectory to compress.
includeRootDirectorybooleanIndicates whether to include the root directory itself or not.

Returns: AppleArchive - The archive with entries composed.

createEntry(String name, File fileInfo)

public final AppleArchiveEntry createEntry(String name, File fileInfo)

Creates a single entry within the archive.

Parameters:

ParameterTypeDescription
namejava.lang.StringThe name of the entry.
fileInfojava.io.FileThe metadata of file to be compressed.

Returns: AppleArchiveEntry - Apple Archive entry instance.

createEntry(String name, File fileInfo, boolean openImmediately)

public final AppleArchiveEntry createEntry(String name, File fileInfo, boolean openImmediately)

Creates a single entry within the archive.

Parameters:

ParameterTypeDescription
namejava.lang.StringThe name of the entry.
fileInfojava.io.FileThe metadata of file to be compressed.
openImmediatelybooleanTrue, if open the file immediately, otherwise open the file on archive saving.

Returns: AppleArchiveEntry - Apple Archive entry instance.

createEntry(String name, InputStream source)

public final AppleArchiveEntry createEntry(String name, InputStream source)

Creates a single entry within the archive.

Parameters:

ParameterTypeDescription
namejava.lang.StringThe name of the entry.
sourcejava.io.InputStreamThe input stream for the entry.

Returns: AppleArchiveEntry - Apple Archive entry instance.

createEntry(String name, String path)

public final AppleArchiveEntry createEntry(String name, String path)

Creates a single entry within the archive.

Parameters:

ParameterTypeDescription
namejava.lang.StringThe name of the entry.
pathjava.lang.StringThe path to the file to compress.

Returns: AppleArchiveEntry - Apple Archive entry instance.

createEntry(String name, String path, boolean openImmediately)

public final AppleArchiveEntry createEntry(String name, String path, boolean openImmediately)

Creates a single entry within the archive.

Parameters:

ParameterTypeDescription
namejava.lang.StringThe name of the entry.
pathjava.lang.StringThe path to the file to compress.
openImmediatelybooleanTrue, if open the file immediately, otherwise open the file on archive saving.

Returns: AppleArchiveEntry - Apple Archive entry instance.

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.

Parameters:

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

getEntries()

public final List<AppleArchiveEntry> getEntries()

Gets entries constituting the archive.

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

getFileEntries()

public 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 archive

getFormat()

public final ArchiveFormat getFormat()

Gets the archive format.

Returns: ArchiveFormat - the archive format

getNewEntrySettings()

public final AppleArchiveEntrySettings getNewEntrySettings()

Gets settings used for newly composed entries.

Returns: AppleArchiveEntrySettings - settings used for newly composed entries.

isSolid()

public final boolean isSolid()

Gets a value indicating whether the archive uses solid compression. In solid mode, all entry data is compressed as a single stream and individual entry extraction is not available. Use IArchive.ExtractToDirectory() instead.

Returns: boolean - a value indicating whether the archive uses solid compression.

save(OutputStream output)

public final void save(OutputStream output)

Saves archive to the stream provided.

Parameters:

ParameterTypeDescription
outputjava.io.OutputStreamDestination stream.

output must be writable. Some compression settings, such as LZ4, also require a seekable stream. |

save(String destinationFileName)

public final void save(String destinationFileName)

Saves archive to a destination file provided.

Parameters:

ParameterTypeDescription
destinationFileNamejava.lang.StringThe path of the archive to be created.