#include <ArchiveWriterAPI.h>
Inherited by Archive::ArchiveWriter.
Interface for the ArchiveWriter of O3DE Archive format The caller is required to supply a ArchiveWriterSettings structure instance which contains the ArchiveHeader and ArchiveTableOfContents data to use when writing to the Archive file The class can be initialized with a user supplied AZ::IO::GenericStream class in which case the stream needs to be open with OpenMode::ModeUpdate The reason why is that to locate information about any content files in order to update an existing archive it read access is needed The recommend OpenMode value for opening a new archive or updating an existing archive are as follows constexpr OpenMode mode = OpenMode::Update | OpenMode::Append | OpenMode::Binary The Append option makes sure that the Archive is not truncated on open
◆ CommitResult
Write the updated ArchiveHeader to the beginning of the stream and Table of Contents to end of the stream
If this call is successful, the archive TOC has been successfully written This function has been marked [[nodiscard]], to ensure the caller checks the return value
- Returns
- A successful expectation if the TOC has been written
◆ AddFileToArchive() [1/2]
Adds the content from the stream to the relative path
- Parameters
-
inputStream | stream class where data for the file is source from The entire stream is read into the memory and written into archive |
fileSettings | settings used to configure the relative path to write to the archive for the given file data. It also allows users to configure the compression algorithm to use, and whether the AddFileToArchive logic fails if an existing file is being added |
- Returns
- ArchiveAddFileResult containing the actual compression file path as saved to the Archive TOC, the compression algorithm used and an Archive File Token which can be used to remove the file if need be On failure, the result outcome contains any errors that have occurred
Implemented in Archive::ArchiveWriter.
◆ AddFileToArchive() [2/2]
Use the span contents to add the file to the archive
- Parameters
-
inputSpan | view of data which will be written to the archive at the relative path supplied in the @fileSettings parameter |
fileSettings | settings used to configure the relative path to write to the archive for the given file data. It also allows users to configure the compression algorithm to use, and whether the AddFileToArchive logic fails if an existing file is being added |
- Returns
- ArchiveAddFileResult containing the actual compression file path as saved to the Archive TOC, the compression algorithm used and an Archive File Token which can be used to remove the file if need be On failure, the result outcome contains any errors that have occurred
Implemented in Archive::ArchiveWriter.
◆ ContainsFile()
virtual bool Archive::IArchiveWriter::ContainsFile |
( |
AZ::IO::PathView |
relativePath | ) |
const |
|
pure virtual |
Returns if the archive contains a relative path
- Parameters
-
relativePath | Relative path within archive to search for |
- Returns
- true if the relative path is contained with the Archive equivalent to
return FindFile(relativePath) != InvalidArchiveFileToken;
Implemented in Archive::ArchiveWriter.
◆ DumpArchiveMetadata()
virtual bool Archive::IArchiveWriter::DumpArchiveMetadata |
( |
AZ::IO::GenericStream & |
metadataStream, |
|
|
const ArchiveMetadataSettings & |
metadataSettings = {} |
|
) |
| const |
|
pure virtual |
Dump metadata for the archive to the supplied generic stream
- Parameters
-
metadataStream | archive file metadata will be written to the stream |
metadataSettings | settings using which control the file metadata to write to the stream |
- Returns
- true if metadata was successfully written
Implemented in Archive::ArchiveWriter.
◆ FindFile()
virtual ArchiveFileToken Archive::IArchiveWriter::FindFile |
( |
AZ::IO::PathView |
relativePath | ) |
const |
|
pure virtual |
Searches for a relative path within the archive
- Parameters
-
relativePath | Relative path within archive to search for |
- Returns
- A token that identifies the Archive file if it exist if the with the specified path doesn't exist InvalidArchiveFileToken is returned
Implemented in Archive::ArchiveWriter.
◆ IsMounted()
virtual bool Archive::IArchiveWriter::IsMounted |
( |
| ) |
const |
|
pure virtual |
◆ MountArchive()
virtual bool Archive::IArchiveWriter::MountArchive |
( |
AZ::IO::PathView |
archivePath | ) |
|
|
pure virtual |
Opens the archive path and returns true if successful Will unmount any previously mounted archive
Implemented in Archive::ArchiveWriter.
◆ RemoveFileFromArchive() [1/2]
Removes the file from the archive using the ArchiveFileToken
- Parameters
-
filePathToken | Relative path within archive to search for NOTE: The entry in the table of contents is not actually removed The index where the file is located using the filePathToken is just added to the removed file indices set |
- Returns
- ArchiveRemoveResult with metadata about how the deleted file was stored in the Archive
Implemented in Archive::ArchiveWriter.
◆ RemoveFileFromArchive() [2/2]
Removes the file from the archive using a relative path name
- Parameters
-
relativePath | Relative path within archive to search for |
- Returns
- ArchiveRemoveResult with metadata about how the deleted file was stored in the Archive
Implemented in Archive::ArchiveWriter.
◆ UnmountArchive()
virtual void Archive::IArchiveWriter::UnmountArchive |
( |
| ) |
|
|
pure virtual |
Closes the handle to the mounted archive stream This will invoke the Commit() function to write the archive TOC to the stream before closing the stream
Implemented in Archive::ArchiveWriter.
The documentation for this class was generated from the following files:
- Gems/Archive/Code/Include/Archive/Tools/ArchiveWriterAPI.h
- Gems/Archive/Code/Include/Archive/Tools/ArchiveWriterAPI.inl