mirror of
https://github.com/revanced/Apktool.git
synced 2025-01-20 16:57:34 +01:00
DexFileBuilder: added possibility to name streams.
This commit is contained in:
parent
853d807f59
commit
f9c9588f1d
@ -32,15 +32,17 @@ import org.jf.smali.*;
|
||||
public class DexFileBuilder {
|
||||
public void addSmaliFile(File smaliFile) throws AndrolibException {
|
||||
try {
|
||||
addSmaliFile(new FileInputStream(smaliFile));
|
||||
addSmaliFile(new FileInputStream(smaliFile),
|
||||
smaliFile.getAbsolutePath());
|
||||
} catch (FileNotFoundException ex) {
|
||||
throw new AndrolibException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
public void addSmaliFile(InputStream smaliStream) throws AndrolibException {
|
||||
public void addSmaliFile(InputStream smaliStream, String name)
|
||||
throws AndrolibException {
|
||||
try {
|
||||
if (!assembleSmaliFile(smaliStream)) {
|
||||
if (!assembleSmaliFile(smaliStream, name)) {
|
||||
throw new AndrolibException(
|
||||
"Could not smali file: " + smaliStream);
|
||||
}
|
||||
@ -80,9 +82,10 @@ public class DexFileBuilder {
|
||||
return bytes;
|
||||
}
|
||||
|
||||
private boolean assembleSmaliFile(InputStream smaliStream)
|
||||
private boolean assembleSmaliFile(InputStream smaliStream, String name)
|
||||
throws IOException, RecognitionException {
|
||||
ANTLRInputStream input = new ANTLRInputStream(smaliStream, "UTF8");
|
||||
input.name = name;
|
||||
|
||||
smaliLexer lexer = new smaliLexer(input);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user