mirror of
https://github.com/revanced/Apktool.git
synced 2025-01-06 01:55:53 +01:00
fix: remove unused util methods/exceptions
This commit is contained in:
parent
3d3dd07cf2
commit
64eda064eb
@ -39,37 +39,10 @@ abstract public class Jar {
|
|||||||
return file;
|
return file;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static File getResourceAsFile(String name) throws BrutException {
|
|
||||||
return getResourceAsFile(name, Class.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void load(String libPath) {
|
|
||||||
if (mLoaded.contains(libPath)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
File libFile;
|
|
||||||
try {
|
|
||||||
libFile = getResourceAsFile(libPath);
|
|
||||||
} catch (BrutException ex) {
|
|
||||||
throw new UnsatisfiedLinkError(ex.getMessage());
|
|
||||||
}
|
|
||||||
|
|
||||||
System.load(libFile.getAbsolutePath());
|
|
||||||
}
|
|
||||||
|
|
||||||
public static File extractToTmp(String resourcePath) throws BrutException {
|
|
||||||
return extractToTmp(resourcePath, Class.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static File extractToTmp(String resourcePath, Class clazz) throws BrutException {
|
public static File extractToTmp(String resourcePath, Class clazz) throws BrutException {
|
||||||
return extractToTmp(resourcePath, "brut_util_Jar_", clazz);
|
return extractToTmp(resourcePath, "brut_util_Jar_", clazz);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static File extractToTmp(String resourcePath, String tmpPrefix) throws BrutException {
|
|
||||||
return extractToTmp(resourcePath, tmpPrefix, Class.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static File extractToTmp(String resourcePath, String tmpPrefix, Class clazz) throws BrutException {
|
public static File extractToTmp(String resourcePath, String tmpPrefix, Class clazz) throws BrutException {
|
||||||
try {
|
try {
|
||||||
InputStream in = clazz.getResourceAsStream(resourcePath);
|
InputStream in = clazz.getResourceAsStream(resourcePath);
|
||||||
|
@ -49,7 +49,7 @@ public class OS {
|
|||||||
dir.delete();
|
dir.delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void rmfile(String file) throws BrutException {
|
public static void rmfile(String file) {
|
||||||
File del = new File(file);
|
File del = new File(file);
|
||||||
del.delete();
|
del.delete();
|
||||||
}
|
}
|
||||||
@ -83,21 +83,21 @@ public class OS {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void cpdir(String src, String dest) throws BrutException {
|
|
||||||
cpdir(new File(src), new File(dest));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void exec(String[] cmd) throws BrutException {
|
public static void exec(String[] cmd) throws BrutException {
|
||||||
Process ps = null;
|
Process ps;
|
||||||
int exitValue = -99;
|
int exitValue;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
ProcessBuilder builder = new ProcessBuilder(cmd);
|
ProcessBuilder builder = new ProcessBuilder(cmd);
|
||||||
ps = builder.start();
|
ps = builder.start();
|
||||||
|
|
||||||
new StreamForwarder(ps.getErrorStream(), "ERROR").start();
|
new StreamForwarder(ps.getErrorStream(), "ERROR").start();
|
||||||
new StreamForwarder(ps.getInputStream(), "OUTPUT").start();
|
new StreamForwarder(ps.getInputStream(), "OUTPUT").start();
|
||||||
|
|
||||||
exitValue = ps.waitFor();
|
exitValue = ps.waitFor();
|
||||||
if (exitValue != 0)
|
if (exitValue != 0) {
|
||||||
throw new BrutException("could not exec (exit code = " + exitValue + "): " + Arrays.toString(cmd));
|
throw new BrutException("could not exec (exit code = " + exitValue + "): " + Arrays.toString(cmd));
|
||||||
|
}
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
throw new BrutException("could not exec: " + Arrays.toString(cmd), ex);
|
throw new BrutException("could not exec: " + Arrays.toString(cmd), ex);
|
||||||
} catch (InterruptedException ex) {
|
} catch (InterruptedException ex) {
|
||||||
|
Loading…
Reference in New Issue
Block a user