Class TransferUtil


  • public class TransferUtil
    extends Object
    This utility class implements a method for copying a whole resorces to a new location in the file system.
    Author:
    ram
    • Constructor Detail

      • TransferUtil

        public TransferUtil()
    • Method Detail

      • moveFile

        public static void moveFile​(File moveFrom,
                                    File moveTo,
                                    boolean isDelete)
      • moveFile

        public static void moveFile​(File moveFrom,
                                    File moveTo)
      • copyFileChannel

        public void copyFileChannel​(File sourceFile,
                                    File destFile)
                             throws IOException
        Copy a file from a location to another
        Parameters:
        sourceFile - a File object represents the source file
        destFile - a File object represents the destination file
        Throws:
        IOException - thrown if IO error occurred.
      • copyDirectory

        public void copyDirectory​(File sourceDir,
                                  File destDir)
                           throws IOException
        Copy a whole directory to another location.
        Parameters:
        sourceDir - a File object represents the source directory
        destDir - a File object represents the destination directory
        Throws:
        IOException - thrown if IO error occurred.
      • splitFileWithChunkSize

        public static void splitFileWithChunkSize​(String mainFileName,
                                                  int chunkSize)
                                           throws Exception
        this method split main file into small packet with given chunk size
        Parameters:
        mainFileName -
        chunkSize -
        Throws:
        Exception