TransferFileCopy.java

import java.io.*;
import java.nio.*;
import java.nio.channels.*;
public class TransferFileCopy {
  public static void main(String[] args) throws IOException {
    FileInputStream fIn = new FileInputStream(args[0]);
    FileOutputStream fOut = new FileOutputStream(args[1]);
    FileChannel cIn = fIn.getChannel();
    FileChannel cOut = fOut.getChannel();
    try {
      cOut.transferFrom(cIn,0,cIn.size());
      //cIn.transferTo(0,cIn.size(),cOut); // Autre solution
    } finally {
      cIn.close();
      cOut.close();
    }
  }
}