| 20 | size_t const VersionedJson::MagicStringSize = 6; |
| 21 | |
| 22 | VersionedJson 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 | |
| 31 | void VersionedJson::writeFile(VersionedJson const& versionedJson, String const& filename) { |
| 32 | DataStreamBuffer ds; |