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
| Constructor | Description |
|---|---|
| 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
| Method | Description |
|---|---|
| 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:
| Parameter | Type | Description |
|---|---|---|
| newEntrySettings | AppleArchiveEntrySettings | Settings 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:
| Parameter | Type | Description |
|---|---|---|
| sourceStream | java.io.InputStream | The 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:
| Parameter | Type | Description |
|---|---|---|
| sourceStream | java.io.InputStream | The source of the archive. |
| loadOptions | AppleArchiveLoadOptions | Options 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:
| Parameter | Type | Description |
|---|---|---|
| path | java.lang.String | The 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:
| Parameter | Type | Description |
|---|---|---|
| path | java.lang.String | The fully qualified or the relative path to the archive file. |
| loadOptions | AppleArchiveLoadOptions | Options 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:
| Parameter | Type | Description |
|---|---|---|
| directory | java.io.File | Directory 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:
| Parameter | Type | Description |
|---|---|---|
| directory | java.io.File | Directory to compress. |
| includeRootDirectory | boolean | Indicates 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:
| Parameter | Type | Description |
|---|---|---|
| name | java.lang.String | The name of the entry. |
| fileInfo | java.io.File | The 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:
| Parameter | Type | Description |
|---|---|---|
| name | java.lang.String | The name of the entry. |
| fileInfo | java.io.File | The metadata of file to be compressed. |
| openImmediately | boolean | True, 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:
| Parameter | Type | Description |
|---|---|---|
| name | java.lang.String | The name of the entry. |
| source | java.io.InputStream | The 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:
| Parameter | Type | Description |
|---|---|---|
| name | java.lang.String | The name of the entry. |
| path | java.lang.String | The 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:
| Parameter | Type | Description |
|---|---|---|
| name | java.lang.String | The name of the entry. |
| path | java.lang.String | The path to the file to compress. |
| openImmediately | boolean | True, 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:
| Parameter | Type | Description |
|---|---|---|
| destinationDirectory | java.lang.String | The 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:
| Parameter | Type | Description |
|---|---|---|
| output | java.io.OutputStream | Destination 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:
| Parameter | Type | Description |
|---|---|---|
| destinationFileName | java.lang.String | The path of the archive to be created. |