Skip to content

EntropyEngine::Core::IO::PackageReader

Reads assets from EntropyPackage files. More…

#include <PackageReader.h>

Name
structImpl
Name
~PackageReader()
std::string_viewsceneRoot() const
Get the scene root path.
PackageResult< std::vector< uint8_t > >read(std::string_view virtualPath)
Read and decompress an asset.
const std::filesystem::path &path() const
Get the path to the opened package file.
PackageReader &operator=(const PackageReader & ) =delete
PackageReader &operator=(PackageReader && )
PackageResult< std::unique_ptr< PackageReader > >open(const std::filesystem::path & path)
Open an unencrypted package.
PackageResult< std::unique_ptr< PackageReader > >open(const std::filesystem::path & path, std::span< const uint8_t, 32 > symmetricKey)
Open an encrypted package.
const PackageManifest &manifest() const
Get the package manifest.
std::vector< std::string >listDirectory(std::string_view directory) const
List files in a virtual directory.
std::vector< AssetInfo >list() const
Get all assets in the package.
boolisEncrypted() const
Check if package is encrypted.
std::optional< AssetInfo >getInfo(std::string_view virtualPath) const
Get asset info without reading content.
boolexists(std::string_view virtualPath) const
Check if a virtual path exists in the package.
PackageReader(const PackageReader & ) =delete
PackageReader(PackageReader && )
class EntropyEngine::Core::IO::PackageReader;

Reads assets from EntropyPackage files.

Thread-safe for concurrent read operations. Memory-maps the package file for efficient streaming access to individual assets.

Usage:

auto result = PackageReader::open("content.epak");
if (result.failed()) {
// Handle error
}
auto& reader = result.value;
// List assets
for (const auto& asset : reader->list()) {
std::cout << asset.path << " (" << asset.uncompressedSize << " bytes)\n";
}
// Read an asset
auto data = reader->read("meshes/character.mesh");
if (data.success()) {
// Use data.value
}
~PackageReader()
std::string_view sceneRoot() const

Get the scene root path.

PackageResult< std::vector< uint8_t > > read(
std::string_view virtualPath
)

Read and decompress an asset.

Parameters:

  • virtualPath Path within the package

Return: Result containing decompressed data or error

Automatically decrypts if package is encrypted and verifies hash.

const std::filesystem::path & path() const

Get the path to the opened package file.

PackageReader & operator=(
const PackageReader &
) =delete
PackageReader & operator=(
PackageReader &&
)
static PackageResult< std::unique_ptr< PackageReader > > open(
const std::filesystem::path & path
)

Open an unencrypted package.

Parameters:

  • path Path to .epak file

Return: Result containing reader or error

static PackageResult< std::unique_ptr< PackageReader > > open(
const std::filesystem::path & path,
std::span< const uint8_t, 32 > symmetricKey
)

Open an encrypted package.

Parameters:

  • path Path to .epak file
  • symmetricKey 32-byte AES-256 key

Return: Result containing reader or error

const PackageManifest & manifest() const

Get the package manifest.

std::vector< std::string > listDirectory(
std::string_view directory
) const

List files in a virtual directory.

Parameters:

  • directory Virtual directory path (e.g., “meshes/”)

Return: Paths of files in that directory (not recursive)

std::vector< AssetInfo > list() const

Get all assets in the package.

bool isEncrypted() const

Check if package is encrypted.

std::optional< AssetInfo > getInfo(
std::string_view virtualPath
) const

Get asset info without reading content.

bool exists(
std::string_view virtualPath
) const

Check if a virtual path exists in the package.

PackageReader(
const PackageReader &
) =delete
PackageReader(
PackageReader &&
)

Updated on 2026-01-26 at 16:50:32 -0500