code: private static void doCopyFile(File srcFile, File destFile) throws IOException
     {
        if (destFile.exists() && destFile.isDirectory())
        {
           throw new IOException("Destination '" + destFile + "' exists but is a directory");
        }
  
        FileInputStream fis = null;
        FileOutputStream fos = null;
        FileChannel input = null;
        FileChannel output = null;
        try
        {
           fis = new FileInputStream(srcFile);
           fos = new FileOutputStream(destFile);
           input = fis.getChannel();
           output = fos.getChannel();
           long size = input.size();
           long pos = 0;
           long count = 0;
           while (pos < size)
           {
              count = (size - pos) > FIFTY_MB ? FIFTY_MB : (size - pos);
              pos += output.transferFrom(input, pos, count);
           }
        }
        finally
        {
           Streams.closeQuietly(output);
           Streams.closeQuietly(fos);
           Streams.closeQuietly(input);
           Streams.closeQuietly(fis);
        }
  
        if (srcFile.length() != destFile.length())
        {
           throw new IOException("Failed to copy full contents from '" +
                    srcFile + "' to '" + destFile + "'");
        }
     }
docs: Internal copy file method.
  
  @param srcFile the validated source file, must not be <code>null</code>
  @param destFile the validated destination file, must not be <code>null</code>
  @throws IOException if an error occurs