private static void createZipFrom(final File dir) throws IOException {
        Files.walkFileTree(dir.toPath(), new FileVisitor<Path>() {
            Path tmp = dir.toPath();

            @Override
            public FileVisitResult postVisitDirectory(Path dir1, IOException exc) throws IOException {
                return FileVisitResult.CONTINUE;
            }

            @Override
            public FileVisitResult preVisitDirectory(Path dir1, BasicFileAttributes attrs) throws IOException {
                return FileVisitResult.CONTINUE;
            }

            @Override
            public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
                FileInputStream in = new FileInputStream(file.toString());
                zipOut.putNextEntry(new ZipEntry(file.subpath(this.tmp.getNameCount(), file.getNameCount()).toString()
                        .substring(prefixLength)));

                int bytesRead;
                while ((bytesRead = in.read(ioBuffer)) > 0) {
                    zipOut.write(ioBuffer, 0, bytesRead);
                }

                zipOut.closeEntry();
                in.close();
                return FileVisitResult.CONTINUE;
            }

            @Override
            public FileVisitResult visitFileFailed(Path file, IOException exc) throws IOException {
                return FileVisitResult.TERMINATE;
            }
        });
    }