MCPcopy Create free account
hub / github.com/OpenStarbound/OpenStarbound / PackedAssetSource

Method PackedAssetSource

source/base/StarPackedAssetSource.cpp:71–86  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

69}
70
71PackedAssetSource::PackedAssetSource(String const& filename) {
72 m_packedFile = File::open(filename, IOMode::Read);
73
74 DataStreamIODevice ds(m_packedFile);
75 if (ds.readBytes(8) != ByteArray("SBAsset6", 8))
76 throw AssetSourceException("Packed assets file format unrecognized!");
77
78 uint64_t indexStart = ds.read<uint64_t>();
79
80 ds.seek(indexStart);
81 ByteArray header = ds.readBytes(5);
82 if (header != ByteArray("INDEX", 5))
83 throw AssetSourceException("No index header found!");
84 ds.read(m_metadata);
85 ds.read(m_index);
86}
87
88JsonObject PackedAssetSource::metadata() const {
89 return m_metadata;

Callers

nothing calls this directly

Calls 4

ByteArrayClass · 0.85
readBytesMethod · 0.45
seekMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected