@SuppressWarnings("unchecked") @Override protected void handleFile(final File file, final int depth, final Collection results) throws IOException { final String entryPath = getUnixStylePath(StringUtils.substringAfter(file.getAbsolutePath(), source.toAbsolutePath().toString() + File.separator)); //ZipArchiveEntry entry = (ZipArchiveEntry) out.createArchiveEntry(file, entryPath); //out.putArchiveEntry(entry); final ZipEntry entry = new ZipEntry(entryPath); out.putNextEntry(entry); try (final InputStream in = new BufferedInputStream(Files.newInputStream(file.toPath()))) { bytesProcessed = writeFile(in, out, callback, bytesProcessed, bytesToProcess); } finally { //out.closeArchiveEntry(); out.closeEntry(); } }
@SuppressWarnings("unchecked") @Override protected void handleFile(File file, int depth, Collection results) throws IOException { String entryPath = getUnixStylePath(StringUtils.substringAfter(file .getAbsolutePath(), sourcePath)); //ZipArchiveEntry entry = (ZipArchiveEntry) out.createArchiveEntry(file, entryPath); //out.putArchiveEntry(entry); ZipEntry entry = new ZipEntry(entryPath); out.putNextEntry(entry); final BufferedInputStream in = new BufferedInputStream(new FileInputStream(file)); try { bytesProcessed = writeFile(in, out, callback, bytesProcessed, bytesToProcess); } finally { //out.closeArchiveEntry(); out.closeEntry(); in.close(); } }