use BufferedInputStream for APK

faster xml escape function
This commit is contained in:
thuxnder 2015-02-27 06:29:44 +01:00 committed by Connor Tumbleson
parent 3736ecef32
commit 07b43d687c
2 changed files with 5 additions and 3 deletions

View File

@ -619,8 +619,8 @@ final public class AndrolibResources {
private ResPackage[] getResPackagesFromApk(ExtFile apkFile,ResTable resTable, boolean keepBroken)
throws AndrolibException {
try {
return ARSCDecoder.decode(apkFile.getDirectory().getFileInput("resources.arsc"),false,
keepBroken, resTable).getPackages();
BufferedInputStream bfi = new BufferedInputStream(apkFile.getDirectory().getFileInput("resources.arsc"));
return ARSCDecoder.decode(bfi, false, keepBroken, resTable).getPackages();
} catch (DirectoryException ex) {
throw new AndrolibException("Could not load resources.arsc from file: " + apkFile, ex);
}

View File

@ -22,13 +22,15 @@ import java.awt.event.KeyEvent;
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
/**
* @author Ryszard Wiśniewski <brut.alll@gmail.com>
*/
public final class ResXmlEncoders {
public static String escapeXmlChars(String str) {
return str.replace("&", "&amp;").replace("<", "&lt;");
return StringUtils.replace(StringUtils.replace(str, "&", "&amp;"), "<", "&lt;");
}
public static String encodeAsResXmlAttr(String str) {