Class IOUtils


  • public final class IOUtils
    extends java.lang.Object
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String xxhash32​(java.nio.file.Path path)
      Calculate the checksum of the file using the default buffer size
      static java.lang.String xxhash32​(java.nio.file.Path path, int bufferSize)
      Calculate the checksum of the file using the specified buffer size
      static long zip​(java.nio.file.Path sourcePath, java.nio.file.Path targetPath)
      Zip the files under source path.
      static long zip​(java.nio.file.Path sourcePath, java.nio.file.Path targetPath, int maxDepth)
      Zip the files under source path.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • zip

        public static long zip​(java.nio.file.Path sourcePath,
                               java.nio.file.Path targetPath)
                        throws java.io.IOException
        Zip the files under source path. It doest not zip recursively.
        Parameters:
        sourcePath - directory that contains files to be zipped
        targetPath - output zip file path
        Returns:
        compressed size, i.e. the size of the zip file
        Throws:
        java.io.IOException - I/O exception during zipping
      • zip

        public static long zip​(java.nio.file.Path sourcePath,
                               java.nio.file.Path targetPath,
                               int maxDepth)
                        throws java.io.IOException
        Zip the files under source path. The files within the maxDepth directory levels are considered.
        Parameters:
        sourcePath - directory that contains files to be zipped
        targetPath - output zip file path
        maxDepth - the maximum number of directory levels to visit
        Returns:
        compressed size, i.e. the size of the zip file
        Throws:
        java.io.IOException - I/O exception during zipping
      • xxhash32

        public static java.lang.String xxhash32​(java.nio.file.Path path,
                                                int bufferSize)
                                         throws java.io.IOException
        Calculate the checksum of the file using the specified buffer size
        Parameters:
        path - file
        bufferSize - buffer size for file content to calculate checksum
        Returns:
        checksum string
        Throws:
        java.io.IOException - I/O exception during checksum calculation
      • xxhash32

        public static java.lang.String xxhash32​(java.nio.file.Path path)
                                         throws java.io.IOException
        Calculate the checksum of the file using the default buffer size
        Parameters:
        path - file
        Returns:
        checksum string
        Throws:
        java.io.IOException - I/O exception during checksum calculation