Exemple #1
0
  private void storeFile(File file) throws FileNotFoundException, IOException {
    Console.printStatus("Storing: " + file);
    try (FileInputStream inputStream = new FileInputStream(file)) {
      _zipStream.putNextEntry(new ZipEntry(file.getCanonicalPath()));

      // Copy the content to the zip stream:

      int length;
      while ((length = inputStream.read(buffer)) > 0) _zipStream.write(buffer, 0, length);

      _zipStream.closeEntry();
    }
  }
Exemple #2
0
 @Override
 public void close() throws IOException {
   _zipStream.close();
   Console.printStatus("Closed: " + _fileName);
 }