mirror of
https://github.com/revanced/Apktool.git
synced 2025-04-30 22:24:25 +02:00
code style
This commit is contained in:
parent
28883538a7
commit
f8fe98d9a6
@ -17,11 +17,13 @@
|
|||||||
package brut.util;
|
package brut.util;
|
||||||
|
|
||||||
import brut.common.BrutException;
|
import brut.common.BrutException;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -29,10 +31,9 @@ import org.apache.commons.io.IOUtils;
|
|||||||
*/
|
*/
|
||||||
abstract public class Jar {
|
abstract public class Jar {
|
||||||
private final static Set<String> mLoaded = new HashSet<String>();
|
private final static Set<String> mLoaded = new HashSet<String>();
|
||||||
private final static Map<String, File> mExtracted =
|
private final static Map<String, File> mExtracted = new HashMap<String, File>();
|
||||||
new HashMap<String, File>();
|
|
||||||
|
|
||||||
public static File getResourceAsFile(String name, Class clazz) throws BrutException {
|
public static File getResourceAsFile(String name, Class clazz) throws BrutException {
|
||||||
File file = mExtracted.get(name);
|
File file = mExtracted.get(name);
|
||||||
if (file == null) {
|
if (file == null) {
|
||||||
file = extractToTmp(name, clazz);
|
file = extractToTmp(name, clazz);
|
||||||
@ -60,16 +61,19 @@ abstract public class Jar {
|
|||||||
System.load(libFile.getAbsolutePath());
|
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) throws BrutException {
|
public static File extractToTmp(String resourcePath, String tmpPrefix) throws BrutException {
|
||||||
return extractToTmp(resourcePath, Class.class);
|
return extractToTmp(resourcePath, tmpPrefix, Class.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static File extractToTmp(String resourcePath, String tmpPrefix, Class clazz)
|
public static File extractToTmp(String resourcePath, String tmpPrefix, Class clazz) throws BrutException {
|
||||||
throws BrutException {
|
|
||||||
try {
|
try {
|
||||||
InputStream in = clazz.getResourceAsStream(resourcePath);
|
InputStream in = clazz.getResourceAsStream(resourcePath);
|
||||||
if (in == null) {
|
if (in == null) {
|
||||||
@ -83,12 +87,7 @@ abstract public class Jar {
|
|||||||
out.close();
|
out.close();
|
||||||
return fileOut;
|
return fileOut;
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
throw new BrutException(
|
throw new BrutException("Could not extract resource: " + resourcePath, ex);
|
||||||
"Could not extract resource: " + resourcePath, ex);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static File extractToTmp(String resourcePath, String tmpPrefix) throws BrutException {
|
|
||||||
return extractToTmp(resourcePath, tmpPrefix, Class.class);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user