use of com.android.tools.build.bundletool.model.BundleMetadata in project bundletool by google.
the class BundleParser method readBundleMetadata.
/**
* Loads BUNDLE-METADATA into {@link BundleMetadata}
*/
public static BundleMetadata readBundleMetadata(ZipFile bundleFile) {
BundleMetadata.Builder metadata = BundleMetadata.builder();
ZipUtils.allFileEntries(bundleFile).filter(entry -> ZipPath.create(entry.getName()).startsWith(METADATA_DIRECTORY)).forEach(zipEntry -> {
ZipPath bundlePath = ZipPath.create(zipEntry.getName());
// Strip the top-level metadata directory.
ZipPath metadataPath = bundlePath.subpath(1, bundlePath.getNameCount());
metadata.addFile(metadataPath, ZipUtils.asByteSource(bundleFile, zipEntry));
});
return metadata.build();
}
Aggregations