本文整理汇总了Java中net.dongliu.apk.parser.struct.AndroidConstants类的典型用法代码示例。如果您正苦于以下问题:Java AndroidConstants类的具体用法?Java AndroidConstants怎么用?Java AndroidConstants使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AndroidConstants类属于net.dongliu.apk.parser.struct包,在下文中一共展示了AndroidConstants类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: parseResourceTable
import net.dongliu.apk.parser.struct.AndroidConstants; //导入依赖的package包/类
/**
* parse resource table.
*/
private void parseResourceTable() throws IOException {
ZipEntry entry = Utils.getEntry(zf, AndroidConstants.RESOURCE_FILE);
if (entry == null) {
// if no resource entry has been found, we assume it is not needed by this APK
this.resourceTable = new ResourceTable();
this.locales = Collections.emptySet();
return;
}
this.resourceTable = new ResourceTable();
this.locales = Collections.emptySet();
InputStream in = zf.getInputStream(entry);
ByteBuffer buffer = ByteBuffer.wrap(Utils.toByteArray(in));
ResourceTableParser resourceTableParser = new ResourceTableParser(buffer);
resourceTableParser.parse();
this.resourceTable = resourceTableParser.getResourceTable();
this.locales = resourceTableParser.getLocales();
}
示例2: parseResourceTable
import net.dongliu.apk.parser.struct.AndroidConstants; //导入依赖的package包/类
private void parseResourceTable() throws IOException {
ZipFile zf = new ZipFile(source);
ZipEntry entry = Utils.getEntry(zf, AndroidConstants.RESOURCE_FILE);
if (entry == null) {
// if no resource entry has been found, we assume it is not needed by this
// APK
this.resourceTable = new ResourceTable();
return;
}
this.resourceTable = new ResourceTable();
InputStream in = zf.getInputStream(entry);
ByteBuffer buffer = ByteBuffer.wrap(Utils.toByteArray(in));
ResourceTableParser resourceTableParser = new ResourceTableParser(buffer);
resourceTableParser.parse();
this.resourceTable = resourceTableParser.getResourceTable();
}
示例3: parseManifest
import net.dongliu.apk.parser.struct.AndroidConstants; //导入依赖的package包/类
private void parseManifest() throws IOException {
if (manifestParsed) {
return;
}
parseResourceTable();
XmlTranslator xmlTranslator = new XmlTranslator();
ApkMetaTranslator apkTranslator = new ApkMetaTranslator(this.resourceTable, this.preferredLocale);
XmlStreamer xmlStreamer = new CompositeXmlStreamer(xmlTranslator, apkTranslator);
byte[] data = getFileData(AndroidConstants.MANIFEST_FILE);
if (data == null) {
throw new ParserException("Manifest file not found");
}
transBinaryXml(data, xmlStreamer);
this.manifestXml = xmlTranslator.getXml();
this.apkMeta = apkTranslator.getApkMeta();
this.iconPaths = apkTranslator.getIconPaths();
manifestParsed = true;
}
示例4: parseResourceTable
import net.dongliu.apk.parser.struct.AndroidConstants; //导入依赖的package包/类
/**
* parse resource table.
*/
private void parseResourceTable() throws IOException {
if (resourceTableParsed) {
return;
}
resourceTableParsed = true;
byte[] data = getFileData(AndroidConstants.RESOURCE_FILE);
if (data == null) {
// if no resource entry has been found, we assume it is not needed by this APK
this.resourceTable = new ResourceTable();
this.locales = Collections.emptySet();
return;
}
ByteBuffer buffer = ByteBuffer.wrap(data);
ResourceTableParser resourceTableParser = new ResourceTableParser(buffer);
resourceTableParser.parse();
this.resourceTable = resourceTableParser.getResourceTable();
this.locales = resourceTableParser.getLocales();
}
示例5: parseManifestXml
import net.dongliu.apk.parser.struct.AndroidConstants; //导入依赖的package包/类
/**
* parse manifest.xml, get manifestXml as xml text.
*
* @throws IOException
*/
private void parseManifestXml() throws IOException {
XmlTranslator xmlTranslator = new XmlTranslator();
ApkMetaTranslator translator = new ApkMetaTranslator();
XmlStreamer xmlStreamer = new CompositeXmlStreamer(xmlTranslator, translator);
transBinaryXml(AndroidConstants.MANIFEST_FILE, xmlStreamer);
this.manifestXml = xmlTranslator.getXml();
if (this.manifestXml == null) {
throw new ParserException("manifest xml not exists");
}
this.apkMeta = translator.getApkMeta();
}
示例6: parseDexFile
import net.dongliu.apk.parser.struct.AndroidConstants; //导入依赖的package包/类
private void parseDexFile() throws IOException {
ZipEntry resourceEntry = Utils.getEntry(zf, AndroidConstants.DEX_FILE);
if (resourceEntry == null) {
throw new ParserException("Resource table not found");
}
InputStream in = zf.getInputStream(resourceEntry);
ByteBuffer buffer = ByteBuffer.wrap(Utils.toByteArray(in));
DexParser dexParser = new DexParser(buffer);
dexParser.parse();
this.dexClasses = dexParser.getDexClasses();
}
示例7: isBinaryXml
import net.dongliu.apk.parser.struct.AndroidConstants; //导入依赖的package包/类
/**
* Decide whether or not a file is binary XML
*
* @param filename
* the name of the file
* @return if filename is the manifest or an xml in the res folder.
*/
private boolean isBinaryXml(String filename) {
if (AndroidConstants.MANIFEST_FILE.equals(filename)) {
return true;
}
if (filename.startsWith(AndroidConstants.RES_PREFIX)
&& filename.toLowerCase().endsWith(".xml")) {
return true;
}
return false;
}
示例8: parseDexFiles
import net.dongliu.apk.parser.struct.AndroidConstants; //导入依赖的package包/类
private void parseDexFiles() throws IOException {
this.dexClasses = parseDexFile(AndroidConstants.DEX_FILE);
for (int i = 2; i < 1000; i++) {
String path = String.format(AndroidConstants.DEX_ADDITIONAL, i);
try {
DexClass[] classes = parseDexFile(path);
this.dexClasses = mergeDexClasses(this.dexClasses, classes);
} catch (ParserException e) {
break;
}
}
}