use of com.google.archivepatcher.shared.DeflateCompressor in project android-bundle-support by lizhangqu.
the class ApkFileByFileDiffParser method createTreeNode.
@NonNull
public static DefaultMutableTreeNode createTreeNode(@NonNull ArchiveContext oldFile, @NonNull ArchiveContext newFile) throws IOException, InterruptedException {
ArchiveNode oldRoot = ArchiveTreeStructure.create(oldFile);
ArchiveNode newRoot = ArchiveTreeStructure.create(newFile);
PatchExplainer explainer = new PatchExplainer(new DeflateCompressor(), new BsDiffDeltaGenerator());
Map<String, Long> pathsToDiffSize = new HashMap<>();
List<EntryExplanation> explanationList = explainer.explainPatch(oldFile.getArchive().getPath().toFile(), newFile.getArchive().getPath().toFile());
for (EntryExplanation explanation : explanationList) {
String path = new String(explanation.getPath().getData(), "UTF8");
pathsToDiffSize.put(path, explanation.getCompressedSizeInPatch());
}
return createTreeNode(oldRoot, newRoot, pathsToDiffSize);
}
Aggregations