Search in sources :

Example 1 with JavaResourceFilter

use of com.android.jarutils.JavaResourceFilter in project android by JetBrains.

the class AndroidApkBuilder method collectDuplicateEntries.

@SuppressWarnings({ "IOResourceOpenedButNotSafelyClosed" })
private static void collectDuplicateEntries(@NotNull String rootFile, @NotNull Set<String> entries, @NotNull Set<String> result) throws IOException {
    final JavaResourceFilter javaResourceFilter = new JavaResourceFilter();
    FileInputStream fis = null;
    ZipInputStream zis = null;
    try {
        fis = new FileInputStream(rootFile);
        zis = new ZipInputStream(fis);
        ZipEntry entry;
        while ((entry = zis.getNextEntry()) != null) {
            if (!entry.isDirectory()) {
                String name = entry.getName();
                if (javaResourceFilter.checkEntry(name) && !entries.add(name)) {
                    result.add(name);
                }
                zis.closeEntry();
            }
        }
    } finally {
        if (zis != null) {
            zis.close();
        }
        if (fis != null) {
            fis.close();
        }
    }
}
Also used : ZipInputStream(java.util.zip.ZipInputStream) JavaResourceFilter(com.android.jarutils.JavaResourceFilter) ZipEntry(java.util.zip.ZipEntry) FileInputStream(java.io.FileInputStream)

Aggregations

JavaResourceFilter (com.android.jarutils.JavaResourceFilter)1 FileInputStream (java.io.FileInputStream)1 ZipEntry (java.util.zip.ZipEntry)1 ZipInputStream (java.util.zip.ZipInputStream)1