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

Method readFile

source/game/StarVersioningDatabase.cpp:22–29  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

20size_t const VersionedJson::MagicStringSize = 6;
21
22VersionedJson VersionedJson::readFile(String const& filename) {
23 DataStreamIODevice ds(File::open(filename, IOMode::Read));
24
25 if (ds.readBytes(MagicStringSize) != ByteArray(Magic, MagicStringSize))
26 throw IOException(strf("Wrong magic bytes at start of versioned json file, expected '{}'", Magic));
27
28 return ds.read<VersionedJson>();
29}
30
31void VersionedJson::writeFile(VersionedJson const& versionedJson, String const& filename) {
32 DataStreamBuffer ds;

Callers

nothing calls this directly

Calls 3

ByteArrayClass · 0.85
strfFunction · 0.85
readBytesMethod · 0.45

Tested by

no test coverage detected