本文整理汇总了Java中net.dongliu.apk.parser.struct.resource.ResourceTable类的典型用法代码示例。如果您正苦于以下问题:Java ResourceTable类的具体用法?Java ResourceTable怎么用?Java ResourceTable使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ResourceTable类属于net.dongliu.apk.parser.struct.resource包,在下文中一共展示了ResourceTable类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: parseResourceTable
import net.dongliu.apk.parser.struct.resource.ResourceTable; //导入依赖的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.resource.ResourceTable; //导入依赖的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: parseResourceTable
import net.dongliu.apk.parser.struct.resource.ResourceTable; //导入依赖的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();
}
示例4: toStringValue
import net.dongliu.apk.parser.struct.resource.ResourceTable; //导入依赖的package包/类
@Override
public String toStringValue(ResourceTable resourceTable, Locale locale) {
// The low-order 4 bits of the data value specify the type of the fraction
short type = (short) (value & 0xf);
String pstr;
switch (type) {
case ResValue.ResDataCOMPLEX.UNIT_FRACTION:
pstr = "%";
break;
case ResValue.ResDataCOMPLEX.UNIT_FRACTION_PARENT:
pstr = "%p";
break;
default:
pstr = "unknown type:0x" + Integer.toHexString(type);
}
float f = Float.intBitsToFloat(value >> 4);
return f + pstr;
}
示例5: toStringValue
import net.dongliu.apk.parser.struct.resource.ResourceTable; //导入依赖的package包/类
public String toStringValue(ResourceTable resourceTable, Locale locale) {
if (rawValue != null) {
return rawValue;
} else if (typedValue != null) {
return typedValue.toStringValue(resourceTable, locale);
} else {
// something happen;
return "";
}
}
示例6: toStringValue
import net.dongliu.apk.parser.struct.resource.ResourceTable; //导入依赖的package包/类
/**
* get value as string
*
* @return
*/
public String toStringValue(ResourceTable resourceTable, Locale locale) {
if (data != null) {
return CDATA_START + data + CDATA_END;
} else {
return CDATA_START + typedData.toStringValue(resourceTable, locale) + CDATA_END;
}
}
示例7: BinaryXmlParser
import net.dongliu.apk.parser.struct.resource.ResourceTable; //导入依赖的package包/类
public BinaryXmlParser(ByteBuffer buffer, ResourceTable resourceTable) {
this.buffer = buffer.duplicate();
this.buffer.order(byteOrder);
this.resourceTable = resourceTable;
}
示例8: ApkMetaTranslator
import net.dongliu.apk.parser.struct.resource.ResourceTable; //导入依赖的package包/类
public ApkMetaTranslator(@Nonnull ResourceTable resourceTable, @Nullable Locale locale) {
this.resourceTable = Objects.requireNonNull(resourceTable);
this.locale = locale;
}