use of net.runelite.http.service.cache.beans.FileEntry in project runelite by runelite.
the class CacheService method getArchiveFiles.
public ArchiveFiles getArchiveFiles(ArchiveEntry archiveEntry) throws IOException {
CacheDAO cacheDao = new CacheDAO();
try (Connection con = sql2o.open();
ResultSetIterable<FileEntry> files = cacheDao.findFilesForArchive(con, archiveEntry)) {
byte[] archiveData = getArchive(archiveEntry);
if (archiveData == null) {
return null;
}
Container result = Container.decompress(archiveData, null);
if (result == null) {
return null;
}
byte[] decompressedData = result.data;
ArchiveFiles archiveFiles = new ArchiveFiles();
for (FileEntry fileEntry : files) {
FSFile file = new FSFile(fileEntry.getFileId());
archiveFiles.addFile(file);
file.setNameHash(fileEntry.getNameHash());
}
archiveFiles.loadContents(decompressedData);
return archiveFiles;
}
}
Aggregations