Beispiel #1
0
 public static void main(final String[] args) throws IOException {
   File f = new File("pokus.zip");
   //    ZipFile zf = new ZipFile(f, ZipFile.OPEN_READ);
   //    ZipFile zf = new ZipFile(f, ZipFile.OPEN_READ | ZipFile.OPEN_DELETE);
   ZipFile zf = new ZipFile(f, ZipFile.OPEN_DELETE);
   System.out.println("pocet zapakovanych polozek: " + zf.size());
 }
  protected void load(String filename) {
    Logger.getLogger(getClass()).debug("Starting group in file " + filename);

    ZipFile zipfile = null;
    try {
      zipfile = new ZipFile(filename);

      fireBeginGroup(filename, zipfile.size());

      Logger.getLogger(getClass()).debug("Loading ZipFile " + filename);
      load(zipfile);
      Logger.getLogger(getClass()).debug("Loaded ZipFile " + filename);

      fireEndGroup(filename);
    } catch (IOException ex) {
      Logger.getLogger(getClass()).error("Cannot load Zip file \"" + filename + "\"", ex);
    } finally {
      if (zipfile != null) {
        try {
          zipfile.close();
        } catch (IOException ex) {
          // Ignore
        }
      }
    }
  }
 public int size() {
   return zf.size();
 }