use of net.lingala.zip4j.io.inputstream.ZipInputStream in project J2ME-Loader by nikita36078.
the class AppInstaller method loadManifest.
private Descriptor loadManifest(File jar) throws IOException {
ZipFile zip = new ZipFile(jar);
FileHeader manifest = zip.getFileHeader(JarFile.MANIFEST_NAME);
if (manifest == null)
throw new IOException("JAR not have " + JarFile.MANIFEST_NAME);
try (ZipInputStream is = zip.getInputStream(manifest)) {
ByteArrayOutputStream baos = new ByteArrayOutputStream(20480);
byte[] buf = new byte[4096];
int read;
while ((read = is.read(buf)) != -1) {
baos.write(buf, 0, read);
}
return new Descriptor(baos.toString(), false);
}
}
Aggregations