Close JarFile
This commit is contained in:
parent
7451fbbeda
commit
25dc7c0bc8
|
|
@ -20,7 +20,7 @@ public class MetaDataReader {
|
||||||
}
|
}
|
||||||
|
|
||||||
private MetaDataReader(File apk) throws IOException {
|
private MetaDataReader(File apk) throws IOException {
|
||||||
JarFile zip = new JarFile(apk);
|
try(JarFile zip = new JarFile(apk)) {
|
||||||
InputStream is = zip.getInputStream(zip.getEntry("AndroidManifest.xml"));
|
InputStream is = zip.getInputStream(zip.getEntry("AndroidManifest.xml"));
|
||||||
byte[] bytes = getBytesFromInputStream(is);
|
byte[] bytes = getBytesFromInputStream(is);
|
||||||
AxmlReader reader = new AxmlReader(bytes);
|
AxmlReader reader = new AxmlReader(bytes);
|
||||||
|
|
@ -32,6 +32,7 @@ public class MetaDataReader {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static byte[] getBytesFromInputStream(InputStream inputStream) throws IOException {
|
public static byte[] getBytesFromInputStream(InputStream inputStream) throws IOException {
|
||||||
try (ByteArrayOutputStream bos = new ByteArrayOutputStream()) {
|
try (ByteArrayOutputStream bos = new ByteArrayOutputStream()) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue