class ZipUtils {

    public static List<String> generateZip(String srcFolder, String outputZip) throws IOException, URISyntaxException {

        final Path targetZip = Paths.get(outputZip);
        final Path sourceDir = Paths.get(srcFolder);
        final URI uri = new URI("jar", URLDecoder.decode(targetZip.toUri().toString(), "UTF-8"), null);
        final List<String> files = new ArrayList<>();

        try (FileSystem zipfs = FileSystems.newFileSystem(uri, singletonMap("create", "true"))) {
            Files.walkFileTree(sourceDir, new SimpleFileVisitor<Path>() {
                @Override
                public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
                    // In case the target zip is being created in the folder being zipped (e.g. Fedlet), ignore it.
                    if (targetZip.equals(file)) {
                        return FileVisitResult.CONTINUE;
                    }
                    Path target = zipfs.getPath(sourceDir.relativize(file).toString());

                    if (target.getParent() != null) {
                        Files.createDirectories(target.getParent());
                    }
                    Files.copy(file, target, StandardCopyOption.REPLACE_EXISTING);
                    files.add(file.toString());
                    return FileVisitResult.CONTINUE;
                }
            });
        }

        return files;
    }

    private  ZipUtils();

}