18 static constexpr uint8_t GZ_HEADER[3] = { 0x1F, 0x8B, 0x08 };
19 static constexpr uint8_t ZIP_HEADER[4] = { 0x50, 0x4B, 0x03, 0x04 };
21 std::unique_ptr<FileBase> file = std::make_unique<LocalFile>(std::move(
filename), mode);
26 if (memcmp(buf, GZ_HEADER, 3) == 0) {
27 file = std::make_unique<GZFileAdapter>(std::move(file));
28 }
else if (memcmp(buf, ZIP_HEADER, 4) == 0) {
29 file = std::make_unique<ZipFileAdapter>(std::move(file));
33 checked_cast<LocalFile*>(file.get())->preCacheFile();
41 : file(init(std::move(
filename), mode))
71 : file(std::move(other.file))
76 : file(std::move(file_))
84 file = std::move(other.file);
95 file->read(buffer, num);
100 file->write(buffer, num);
115 return file->getSize();
125 return file->getPos();
130 return file->truncate(
size);
140 return file->getURL();
143 string File::getLocalReference()
const
145 return file->getLocalReference();
150 std::string_view orig = file->getOriginalName();
151 return !orig.empty() ? orig :
getURL();
156 return file->isReadOnly();
161 return file->getModificationDate();