本文整理了Java中com.android.tools.build.apkzlib.zip.ZFile.<init>()
方法的一些代码示例,展示了ZFile.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZFile.<init>()
方法的具体详情如下:
包路径:com.android.tools.build.apkzlib.zip.ZFile
类名称:ZFile
方法名:<init>
暂无
代码示例来源:origin: google/bundletool
minSdkVersion);
ZFile zAapt2Files =
new ZFile(binaryApk.toFile(), createZFileOptions(tempDir), /* readOnly= */ true)) {
代码示例来源:origin: google/bundletool
/**
* Checks whether a zip file has been correctly zipaligned.
*
* @return {@code true} if the file has been correctly zipaligned.
*/
public static boolean checkAlignment(File zip) throws IOException {
try (ZFile zfile = new ZFile(zip)) {
for (StoredEntry entry : zfile.entries()) {
CentralDirectoryHeader header = entry.getCentralDirectoryHeader();
// Alignment only applies to uncompressed files.
if (header.getCompressionInfoWithWait().getMethod().equals(CompressionMethod.STORE)) {
int expectedAligment =
NATIVE_LIB_PATTERN.matcher(header.getName()).matches()
? PAGE_ALIGNMENT
: FOUR_BYTE_ALIGNMENT;
long dataOffset = header.getOffset() + entry.getLocalHeaderSize();
if (dataOffset % expectedAligment != 0) {
System.out.println(
String.format(
"File '%s' is not aligned. dataOffset=%d, expectedAlignment=%d",
header.getName(), dataOffset, expectedAligment));
return false;
}
}
}
}
return true;
}
内容来源于网络,如有侵权,请联系作者删除!