Java tutorial
import java.io.FileInputStream; import java.io.FileOutputStream; import java.nio.channels.FileChannel; public class Main { public static void main(String[] args) throws Exception { FileChannel sourceChannel = new FileInputStream("sourceFile").getChannel(); FileChannel sinkChannel = new FileOutputStream("newFile").getChannel(); // Copy source file contents to the sink file sourceChannel.transferTo(0, sourceChannel.size(), sinkChannel); } }