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(); } }
@Override public void close() throws IOException { _zipStream.close(); Console.printStatus("Closed: " + _fileName); }