mirror of
https://github.com/pxb1988/dex2jar.git
synced 2024-11-23 05:10:11 +00:00
Extract Hex class resource logic to a separate method (#20)
* feat: Extract Hex class resource logic to a separate method Sorry for the weird commit message, I couldn't find a way to word it better. Anyways.. This commit extracts the `getResourceAsStream` call to a separate, protected method so it can be overrided, and we can provide the Hex class from a different source. * fix: Check if Hex class stream is null
This commit is contained in:
parent
f3fc040a09
commit
e9e05f8936
@ -529,8 +529,17 @@ public class Dex2Asm {
|
||||
private static final Set<String> HEX_DECODE_METHODS =
|
||||
new HashSet<>(Arrays.asList("decode_J", "decode_I", "decode_S", "decode_B"));
|
||||
|
||||
protected InputStream getHexClassAsStream() {
|
||||
return Dex2Asm.class.getResourceAsStream("/" + HEX_CLASS_LOCATION + ".class");
|
||||
}
|
||||
|
||||
private void addHexDecodeMethod(ClassVisitor outCV, String className, String hexDecodeMethodNameBase) {
|
||||
try (InputStream is = Dex2Asm.class.getResourceAsStream("/" + HEX_CLASS_LOCATION + ".class")) {
|
||||
InputStream hexClassStream = getHexClassAsStream();
|
||||
if (hexClassStream == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
try (InputStream is = hexClassStream) {
|
||||
ClassReader cr = new ClassReader(is);
|
||||
cr.accept(new ClassVisitor(Opcodes.ASM9) {
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user