PIBinaryLog createIndexOnFly, loadIndex, saveIndex features

PIFile readAll and writeAll static methods
This commit is contained in:
2023-05-11 21:44:31 +03:00
parent 96e8ef2b23
commit 1de4304e30
5 changed files with 228 additions and 69 deletions

View File

@@ -622,3 +622,18 @@ bool PIFile::applyFileInfo(const PIString & path, const PIFile::FileInfo & info)
#endif
return true;
}
PIByteArray PIFile::readAll(const PIString & path, bool forceRead) {
PIFile f(path, PIIODevice::ReadOnly);
if (!f.isOpened()) return PIByteArray();
return f.readAll(forceRead);
}
int PIFile::writeAll(const PIString & path, const PIByteArray & data) {
PIFile f(path, PIIODevice::ReadWrite);
if (!f.isOpened()) return 0;
f.clear();
return f.write(data.data(), data.size_s());
}