Refine search
private InputStream getFromJar (String jarFile, String sharedLibrary) throws IOException { ZipFile file = new ZipFile(nativesJar); ZipEntry entry = file.getEntry(sharedLibrary); return file.getInputStream(entry); }
@Override public InputStream _newInputStream() throws IOException { ZipEntry e = zipFile.getEntry(path); return e != null ? zipFile.getInputStream(e) : null; } }
try{ ApplicationInfo ai = getPackageManager().getApplicationInfo(getPackageName(), 0); ZipFile zf = new ZipFile(ai.sourceDir); ZipEntry ze = zf.getEntry("classes.dex"); long time = ze.getTime(); String s = SimpleDateFormat.getInstance().format(new java.util.Date(time)); zf.close(); }catch(Exception e){ }
public static String getZipEntryMd5(File file, String entryName) { ZipFile zipFile = null; try { zipFile = new ZipFile(file); ZipEntry entry = zipFile.getEntry(entryName); if (entry == null) { return null; } return MD5.getMD5(zipFile.getInputStream(entry), 1024 * 100); } catch (IOException e) { e.printStackTrace(); } finally { if (zipFile != null) { try { zipFile.close(); } catch (IOException e) { e.printStackTrace(); } } } return null; }
private Supplier<InputStream> findSourceFileInZip(File zipFile, String fileName) { try (ZipFile zip = new ZipFile(zipFile)) { ZipEntry entry = zip.getEntry(fileName); if (entry == null) { return null; } return () -> { try { ZipInputStream input = new ZipInputStream(new FileInputStream(zipFile)); while (true) { ZipEntry e = input.getNextEntry(); if (e == null) { return null; } if (e.getName().equals(fileName)) { return input; } } } catch (IOException e) { return null; } }; } catch (IOException e) { return null; } }
List<Object[]> media = new ArrayList<>(); JSONObject meta = new JSONObject(Utils.convertStreamToString(z.getInputStream(z.getEntry("_meta")))); Utils.writeToFile(z.getInputStream(i), destPath); String csum = Utils.fileChecksum(destPath); throw new RuntimeException(e); } finally { z.close();
public static LexicalizedParser loadModelFromZip(String zipFilename, String modelName) { LexicalizedParser parser = null; try { File file = new File(zipFilename); if (file.exists()) { ZipFile zin = new ZipFile(file); ZipEntry zentry = zin.getEntry(modelName); if (zentry != null) { InputStream in = zin.getInputStream(zentry); // gunzip it if necessary if (modelName.endsWith(".gz")) { in = new GZIPInputStream(in); } ObjectInputStream ois = new ObjectInputStream(in); parser = loadModel(ois); ois.close(); in.close(); } zin.close(); } else { throw new FileNotFoundException("Could not find " + modelName + " inside " + zipFilename); } } catch (IOException e) { throw new RuntimeIOException(e); } return parser; }
private InputStream getFromJar (String jarFile, String sharedLibrary) throws IOException { ZipFile file = new ZipFile(nativesJar); ZipEntry entry = file.getEntry(sharedLibrary); return file.getInputStream(entry); }
public static String getZipEntryCrc(File file, String entryName) { ZipFile zipFile = null; try { zipFile = new ZipFile(file); ZipEntry entry = zipFile.getEntry(entryName); if (entry == null) { return null; } return String.valueOf(entry.getCrc()); } catch (IOException e) { e.printStackTrace(); } finally { if (zipFile != null) { try { zipFile.close(); } catch (IOException e) { e.printStackTrace(); } } } return null; }
@Override public InputStream openStream(String resourceName) throws IOException { ZipEntry zipEntry = zipFile.getEntry(resourceName); if (zipEntry == null) { return null; } return zipFile.getInputStream(zipEntry); }
private String getSourceFromJar(Class<?> clazz, File srcJarFile) throws ZipException, IOException { final ZipFile zipFile = new ZipFile(srcJarFile); try { final String entryName = clazz.getName().replace('.', '/') + ".java"; ZipEntry entry = zipFile.getEntry(entryName); if (entry == null) { final InputStream inputStream = zipFile.getInputStream(entry); try { final Reader reader = new InputStreamReader(inputStream, Charset.forName("UTF-8")); zipFile.close();
ZipFile zipFile = new ZipFile("file.zip"); ZipEntry zipEntry = zipFile.getEntry("fileName.txt"); InputStream inputStream = zipFile.getInputStream(zipEntry);
private void getCompressMethodFromApk() { ZipFile zipFile = null; try { zipFile = new ZipFile(config.mNewApkFile); ArrayList<String> sets = new ArrayList<>(); sets.addAll(modifiedSet); sets.addAll(addedSet); ZipEntry zipEntry; for (String name : sets) { zipEntry = zipFile.getEntry(name); if (zipEntry != null && zipEntry.getMethod() == ZipEntry.STORED) { storedSet.add(name); } } } catch (Throwable throwable) { } finally { if (zipFile != null) { try { zipFile.close(); } catch (IOException e) { } } } }
private static ByteBuffer getZipEntryData(ZipFile zf, String entryPath) throws IOException { final ZipEntry entry = zf.getEntry(entryPath); InputStream is = null; try { is = new BufferedInputStream(zf.getInputStream(entry)); final byte[] data = Utils.toByteArray(is); return ByteBuffer.wrap(data); } finally { if (is != null) { try { is.close(); } catch (Throwable ignored) { // Ignored. } } } }
@Override public byte[] getBytecode(String externalPath, String internalPath) throws IOException { File file = new File(externalPath); if (internalPath == null) { return InterpreterUtil.getBytes(file); } else { try (ZipFile archive = new ZipFile(file)) { ZipEntry entry = archive.getEntry(internalPath); if (entry == null) throw new IOException("Entry not found: " + internalPath); return InterpreterUtil.getBytes(archive, entry); } } }
ZipFile zipFile = null; try { zipFile = new ZipFile(file); ZipEntry entry = zipFile.getEntry(DexFormat.DEX_IN_JAR_NAME); if (entry != null) { InputStream inputStream = null; try { inputStream = zipFile.getInputStream(entry); loadFrom(inputStream, (int) entry.getSize()); } finally { if (zipFile != null) { try { zipFile.close(); } catch (Exception e) {