Here you can find the source of doZip(Properties properties, String name, File f)
static boolean doZip(Properties properties, String name, File f)
//package com.java2s; import java.io.BufferedInputStream; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.util.Properties; import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; public class Main { /**//from w ww . j ava 2 s. co m * same as above given a .zip or .jar file object. The difference with * this method is that the search does not go deeper than the top level; * ie. no directory recursion is done. */ static boolean doZip(Properties properties, String name, File f) { ZipInputStream zip; try { zip = new ZipInputStream(new FileInputStream(f)); } catch (FileNotFoundException x) { return false; } boolean result = false; ZipEntry ze; try { while ((ze = zip.getNextEntry()) != null) { if (ze.isDirectory()) continue; String it = ze.getName(); int n; if (it.endsWith(name)) { ByteArrayOutputStream out = new ByteArrayOutputStream(2048); byte[] buffer = new byte[512]; while ((n = zip.read(buffer)) != -1) out.write(buffer, 0, n); BufferedInputStream in = new BufferedInputStream(new ByteArrayInputStream(out.toByteArray())); properties.load(in); in.close(); result = true; break; } } } catch (IOException x1) { } finally { try { zip.close(); } catch (IOException x2) { } } return result; } }