Here you can find the source of copyTransfer(String srcPath, String destPath)
public static void copyTransfer(String srcPath, String destPath) throws IOException
//package com.java2s; /*// w w w . j a va 2s . c om * Copyright (c) 2008, AIST, the University of Tokyo and General Robotix Inc. * All rights reserved. This program is made available under the terms of the * Eclipse Public License v1.0 which accompanies this distribution, and is * available at http://www.eclipse.org/legal/epl-v10.html * Contributors: * General Robotix Inc. * National Institute of Advanced Industrial Science and Technology (AIST) */ import java.io.*; import java.nio.channels.*; public class Main { public static void copyTransfer(String srcPath, String destPath) throws IOException { FileChannel srcChannel = new FileInputStream(srcPath).getChannel(); FileChannel destChannel = new FileOutputStream(destPath) .getChannel(); try { srcChannel.transferTo(0, srcChannel.size(), destChannel); } finally { srcChannel.close(); destChannel.close(); } } }