public static void copyFile(CarbonFile sourceLocation,String desTinationLocation) throws IOException {
  InputStream inputStream=null;
  OutputStream outputStream=null;
  try {
    inputStream=FileFactory.getDataInputStream(sourceLocation.getAbsolutePath(),FileFactory.getFileType(sourceLocation.getAbsolutePath()));
    outputStream=FileFactory.getDataOutputStream(desTinationLocation,FileFactory.getFileType(desTinationLocation),10240,true);
    copyFile(inputStream,outputStream);
  }
  finally {
    CarbonUtil.closeStreams(inputStream,outputStream);
  }
}

public static void copyFile ( CarbonFile sourceLocation , String desTinationLocation ) throws IOException { InputStream inputStream = null ; OutputStream outputStream = null ; try { inputStream = FileFactory . getDataInputStream ( sourceLocation . getAbsolutePath ( ) , FileFactory . getFileType ( sourceLocation . getAbsolutePath ( ) ) ) ; outputStream = FileFactory . getDataOutputStream ( desTinationLocation , FileFactory . getFileType ( desTinationLocation ) , 10240 , true ) ; copyFile ( inputStream , outputStream ) ; } finally { CarbonUtil . closeStreams ( inputStream , outputStream ) ; } }
this method will be used for copy file from source to destination location
