本文整理匯總了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;
}