Java tutorial
import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.FileInputStream; import java.io.FileOutputStream; public class Main { public static void main(String[] argv) throws Exception { BufferedInputStream fin = new BufferedInputStream(new FileInputStream("in.dat")); BufferedOutputStream fout = new BufferedOutputStream(new FileOutputStream("out.dat")); int i; do { i = fin.read(); if (i != -1) fout.write(i); } while (i != -1); fin.close(); fout.close(); } }