#include <ArchiveWriter.h>
Inherits Archive::IArchiveWriter.
Public Types | |
using | CommitResult = AZStd::expected< void, ResultString > |
Public Types inherited from Archive::IArchiveWriter | |
using | ArchiveStreamPtr = AZStd::unique_ptr< AZ::IO::GenericStream, ArchiveStreamDeleter > |
using | CommitResult = AZStd::expected< void, ResultString > |
Public Member Functions | |
AZ_TYPE_INFO_WITH_NAME_DECL (ArchiveWriter) | |
AZ_RTTI_NO_TYPE_INFO_DECL () | |
ArchiveWriter (const ArchiveWriterSettings &writerSettings) | |
Create an archive writer using the specified writer settings. | |
ArchiveWriter (AZ::IO::PathView archivePath, const ArchiveWriterSettings &writerSettings={}) | |
ArchiveWriter (ArchiveStreamPtr archiveStream, const ArchiveWriterSettings &writerSettings={}) | |
Takes ownership of the open stream and will optionally delete it based on the ArchiveFileDeleter. | |
bool | MountArchive (AZ::IO::PathView archivePath) override |
bool | MountArchive (ArchiveStreamPtr archiveStream) override |
void | UnmountArchive () override |
bool | IsMounted () const override |
Returns if an open archive that is mounted. | |
CommitResult | Commit () override |
ArchiveAddFileResult | AddFileToArchive (AZ::IO::GenericStream &inputStream, const ArchiveWriterFileSettings &fileSettings) override |
ArchiveAddFileResult | AddFileToArchive (AZStd::span< const AZStd::byte > inputSpan, const ArchiveWriterFileSettings &fileSettings) override |
ArchiveFileToken | FindFile (AZ::IO::PathView relativePath) const override |
bool | ContainsFile (AZ::IO::PathView relativePath) const override |
ArchiveRemoveFileResult | RemoveFileFromArchive (ArchiveFileToken filePathToken) override |
ArchiveRemoveFileResult | RemoveFileFromArchive (AZ::IO::PathView relativePath) override |
bool | DumpArchiveMetadata (AZ::IO::GenericStream &metadataStream, const ArchiveMetadataSettings &metadataSettings={}) const override |
Public Member Functions inherited from Archive::IArchiveWriter | |
AZ_TYPE_INFO_WITH_NAME_DECL (IArchiveWriter) | |
AZ_RTTI_NO_TYPE_INFO_DECL () | |
virtual bool | MountArchive (AZ::IO::PathView archivePath)=0 |
virtual bool | MountArchive (ArchiveStreamPtr archiveStream)=0 |
virtual void | UnmountArchive ()=0 |
virtual bool | IsMounted () const =0 |
Returns if an open archive that is mounted. | |
virtual CommitResult | Commit ()=0 |
virtual ArchiveAddFileResult | AddFileToArchive (AZ::IO::GenericStream &inputStream, const ArchiveWriterFileSettings &fileSettings)=0 |
virtual ArchiveAddFileResult | AddFileToArchive (AZStd::span< const AZStd::byte > inputSpan, const ArchiveWriterFileSettings &fileSettings)=0 |
virtual ArchiveFileToken | FindFile (AZ::IO::PathView relativePath) const =0 |
virtual bool | ContainsFile (AZ::IO::PathView relativePath) const =0 |
virtual ArchiveRemoveFileResult | RemoveFileFromArchive (ArchiveFileToken filePathToken)=0 |
virtual ArchiveRemoveFileResult | RemoveFileFromArchive (AZ::IO::PathView relativePath)=0 |
virtual bool | DumpArchiveMetadata (AZ::IO::GenericStream &metadataStream, const ArchiveMetadataSettings &metadataSettings={}) const =0 |
Public Attributes | |
AZ_CLASS_ALLOCATOR_DECL | |
Public Attributes inherited from Archive::IArchiveWriter | |
AZ_CLASS_ALLOCATOR_DECL | |
class which is used to write into a stream the O3DE Archive format The caller is required to supply a ArchiveWriterSettings structure 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 it should be open in stream should 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
using Archive::ArchiveWriter::CommitResult = AZStd::expected<void, ResultString> |
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
|
explicit |
Open an file at the specified file path and takes sole ownership of it The ArchiveWriter will close the file on Unmount
|
overridevirtual |
Adds the content from the stream to the relative path
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 |
Implements Archive::IArchiveWriter.
|
overridevirtual |
Use the span contents to add the file to the archive
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 |
Implements Archive::IArchiveWriter.
|
overridevirtual |
Implements Archive::IArchiveWriter.
|
overridevirtual |
Returns if the archive contains a relative path
relativePath | Relative path within archive to search for |
return FindFile(relativePath) != InvalidArchiveFileToken;
Implements Archive::IArchiveWriter.
|
overridevirtual |
Dump metadata for the archive to the supplied generic stream
metadataStream | archive file metadata will be written to the stream |
metadataSettings | settings using which control the file metadata to write to the stream |
Implements Archive::IArchiveWriter.
|
overridevirtual |
Searches for a relative path within the archive
relativePath | Relative path within archive to search for |
Implements Archive::IArchiveWriter.
|
overridevirtual |
Returns if an open archive that is mounted.
Implements Archive::IArchiveWriter.
|
overridevirtual |
Implements Archive::IArchiveWriter.
|
overridevirtual |
Opens the archive path and returns true if successful Will unmount any previously mounted archive
Implements Archive::IArchiveWriter.
|
overridevirtual |
Removes the file from the archive using the ArchiveFileToken
filePathToken | Identifier queried using FindFile or AddFileToArchive 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 |
Implements Archive::IArchiveWriter.
|
overridevirtual |
Removes the file from the archive using a relative path name
relativePath | relative path within archive to search for |
Implements Archive::IArchiveWriter.
|
overridevirtual |
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
Implements Archive::IArchiveWriter.