private void addToZip()

in src/main/java/org/apache/commons/release/plugin/mojos/CommonsSiteCompressionMojo.java [104:115]


    private void addToZip(final File directoryToZip, final File file, final ZipOutputStream zos) throws IOException {
        try (InputStream fis = Files.newInputStream(file.toPath())) {
            // we want the zipEntry's path to be a relative path that is relative
            // to the directory being zipped, so chop off the rest of the path
            final String zipFilePath = file.getCanonicalPath().substring(
                    directoryToZip.getCanonicalPath().length() + 1,
                    file.getCanonicalPath().length());
            final ZipEntry zipEntry = new ZipEntry(zipFilePath);
            zos.putNextEntry(zipEntry);
            IOUtils.copy(fis, zos);
        }
    }