Open 3D Engine Archive Gem API Reference 23.10.0
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
Archive::IArchiveReader Class Referenceabstract

#include <ArchiveReaderAPI.h>

Inherited by Archive::ArchiveReader.

Classes

struct  ArchiveStreamDeleter
 

Public Types

using ArchiveStreamPtr = AZStd::unique_ptr< AZ::IO::GenericStream, ArchiveStreamDeleter >
 
using ListFileCallback = AZStd::function< bool(ArchiveListFileResult)>
 

Public Member Functions

 AZ_TYPE_INFO_WITH_NAME_DECL (IArchiveReader)
 
 AZ_RTTI_NO_TYPE_INFO_DECL ()
 
virtual bool MountArchive (AZ::IO::PathView archivePath)=0
 
virtual bool MountArchive (ArchiveStreamPtr archiveStream)=0
 
virtual void UnmountArchive ()=0
 Closes the handle to the mounted archive stream.
 
virtual bool IsMounted () const =0
 Returns if an open archive that is mounted.
 
virtual ArchiveExtractFileResult ExtractFileFromArchive (AZStd::span< AZStd::byte > outputSpan, const ArchiveReaderFileSettings &fileSettings)=0
 
virtual ArchiveListFileResult ListFileInArchive (ArchiveFileToken filePathToken) const =0
 
virtual ArchiveListFileResult ListFileInArchive (AZ::IO::PathView relativePath) const =0
 
virtual bool ContainsFile (AZ::IO::PathView relativePath) const =0
 
virtual EnumerateArchiveResult EnumerateFilesInArchive (ListFileCallback listFileCallback) const =0
 
virtual bool DumpArchiveMetadata (AZ::IO::GenericStream &metadataStream, const ArchiveMetadataSettings &metadataSettings={}) const =0
 

Public Attributes

 AZ_CLASS_ALLOCATOR_DECL
 

Detailed Description

Interface for the ArchiveReader of O3DE Archive format An ArchiveReaderSettings object can be used to customize how an archive is read. Such as the ability to specify the number of read and decompression task that can run in parallel The user can supply their own stream of archive data via the AZ::IO::GenericStream interface In that case the archive needs to be opened with at least OpenMode::Read The recommend OpenMode value for opening the archive are as follows constexpr OpenMode mode = OpenMode::Read | OpenMode::Binary

Member Typedef Documentation

◆ ListFileCallback

Callback structure which is invoked with the metadata for each file in the archive table of contents section This can be used to perform filtering on files within the archive

Returns
a value of true can be returned to continue enumeration of the archive

Member Function Documentation

◆ ContainsFile()

virtual bool Archive::IArchiveReader::ContainsFile ( AZ::IO::PathView  relativePath) const
pure virtual

Returns if the archive contains a relative path

Parameters
relativePathRelative 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::ArchiveReader.

◆ DumpArchiveMetadata()

virtual bool Archive::IArchiveReader::DumpArchiveMetadata ( AZ::IO::GenericStream &  metadataStream,
const ArchiveMetadataSettings metadataSettings = {} 
) const
pure virtual

Dump metadata for the archive to the supplied generic stream

Parameters
metadataStreamwith human readable data about files within the archive will be written to the stream
metadataStreamarchive file metadata will be written to the stream
metadataSettingssettings using which control the file metadata to write to the stream

Implemented in Archive::ArchiveReader.

◆ EnumerateFilesInArchive()

virtual EnumerateArchiveResult Archive::IArchiveReader::EnumerateFilesInArchive ( ListFileCallback  listFileCallback) const
pure virtual

Enumerates all files within the archive table of contents and invokes a callback function with the listing information about the file This function can be used to build filter files in the Archive based on any value supplied in the ArchiveListFileResult structure For example filtering can be done based on file path(such as globbing for all *.txt files) or filtering based on uncompressed size(such as locating all files > 2MiB, etc...)

Parameters
listFileCallbackCallback which is invoked for each file in the archive
Returns
result structure that is convertible to a boolean value indicating if enumeration was successful

Implemented in Archive::ArchiveReader.

◆ ExtractFileFromArchive()

virtual ArchiveExtractFileResult Archive::IArchiveReader::ExtractFileFromArchive ( AZStd::span< AZStd::byte >  outputSpan,
const ArchiveReaderFileSettings fileSettings 
)
pure virtual

Reads the content of the file specified in the ArchiveReadeFileSettings The file path identifier in the settings is used to locate the file to extract from the archive The outputSpan should be a pre-allocated buffer that is large enough to fit either the uncompressed size of the file if the m_decompressFile setting is true or the compressed size of the file if the m_decompressFile setting is false

Parameters
outputSpanpre-allocated buffer that should be large enough to store the extracted file
fileSettingssettings which can configure whether the file should be decompressed, the start offset where to start reading content within the file, how many bytes to read from the file, etc...
Returns
ArchiveExtractFileResult structure which on success contains a span of the actual data extracted from the Archive. NOTE: The extracted data can be smaller than the outputSpan.size() On failure, the result outcome member contains the error that occurred

Implemented in Archive::ArchiveReader.

◆ IsMounted()

virtual bool Archive::IArchiveReader::IsMounted ( ) const
pure virtual

Returns if an open archive that is mounted.

Implemented in Archive::ArchiveReader.

◆ ListFileInArchive() [1/2]

virtual ArchiveListFileResult Archive::IArchiveReader::ListFileInArchive ( ArchiveFileToken  filePathToken) const
pure virtual

List the file metadata from the archive using the ArchiveFileToken

Parameters
filePathTokenidentifier token that can be used to quickly lookup metadata about the file
Returns
ArchiveListResult with metadata for the file if found

Implemented in Archive::ArchiveReader.

◆ ListFileInArchive() [2/2]

virtual ArchiveListFileResult Archive::IArchiveReader::ListFileInArchive ( AZ::IO::PathView  relativePath) const
pure virtual

List the file metadata from the archive using the relative FilePath

Parameters
relativePathFile path to lookup within the archive
Returns
ArchiveListResult with metadata for the file if found

Implemented in Archive::ArchiveReader.

◆ MountArchive()

virtual bool Archive::IArchiveReader::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::ArchiveReader.

◆ UnmountArchive()

virtual void Archive::IArchiveReader::UnmountArchive ( )
pure virtual

Closes the handle to the mounted archive stream.

Implemented in Archive::ArchiveReader.


The documentation for this class was generated from the following files: