new-integration-tests/src/test/java/oracle/weblogic/kubernetes/utils/FileUtils.java
public static String createZipFile(Path dirPath) {
    String zipFileName = dirPath.toString().concat(".zip");
    try {
      final ZipOutputStream outputStream = new ZipOutputStream(new FileOutputStream(zipFileName));
      Files.walkFileTree(dirPath, new SimpleFileVisitor<Path>() {
        @Override
        public FileVisitResult visitFile(Path file, BasicFileAttributes attributes) {
          try {
            Path targetFile = dirPath.relativize(file);
            outputStream.putNextEntry(new ZipEntry(Paths.get(targetFile.toString()).toString()));
            byte[] bytes = Files.readAllBytes(file);
            outputStream.write(bytes, 0, bytes.length);
            outputStream.closeEntry();
          } catch (IOException e) {
            e.printStackTrace();
          }
          return FileVisitResult.CONTINUE;
        }
      });
      outputStream.close();
    } catch (IOException e) {
      e.printStackTrace();
      return null;
    }
    return zipFileName;
  }
/**
   * Create a zip file from a folder.
   *
   * @param dirPath folder to zip
   * @return path of the zipfile
   */
Create a zip file from a folder.
@param dirPath folder to zip
@return path of the zipfile
Create a zip file from a folder . @param dirPath folder to zip @return path of the zipfile
public static String createZipFile(Path dirPath) {
    String zipFileName = dirPath.toString().concat(".zip");
    try {
      final ZipOutputStream outputStream = new ZipOutputStream(new FileOutputStream(zipFileName));
      Files.walkFileTree(dirPath, new SimpleFileVisitor<Path>() {
        @Override
        public FileVisitResult visitFile(Path file, BasicFileAttributes attributes) {
          try {
            Path targetFile = dirPath.relativize(file);
            outputStream.putNextEntry(new ZipEntry(Paths.get(targetFile.toString()).toString()));
            byte[] bytes = Files.readAllBytes(file);
            outputStream.write(bytes, 0, bytes.length);
            outputStream.closeEntry();
          } catch (IOException e) {
            e.printStackTrace();
          }
          return FileVisitResult.CONTINUE;
        }
      });
      outputStream.close();
    } catch (IOException e) {
      e.printStackTrace();
      return null;
    }
    return zipFileName;
  }
public static String createZipFile ( Path dirPath ) { String zipFileName = dirPath . toString ( ) . concat ( ".zip" ) ; try { final ZipOutputStream outputStream = new ZipOutputStream ( new FileOutputStream ( zipFileName ) ) ; Files . walkFileTree ( dirPath , new SimpleFileVisitor < Path > ( ) { @ Override public FileVisitResult visitFile ( Path file , BasicFileAttributes attributes ) { try { Path targetFile = dirPath . relativize ( file ) ; outputStream . putNextEntry ( new ZipEntry ( Paths . get ( targetFile . toString ( ) ) . toString ( ) ) ) ; byte [ ] bytes = Files . readAllBytes ( file ) ; outputStream . write ( bytes , 0 , bytes . length ) ; outputStream . closeEntry ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return FileVisitResult . CONTINUE ; } } ) ; outputStream . close ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; return null ; } return zipFileName ; }
Create a zip file from a folder.
Create a zip file from a folder .