/* program Test_IO.java shows File I/O */ import java.io.*; class Test_IO { public static void main(String[] args) { if (args.length != 2) { System.err.println("Usage: java Test_IO "); System.exit(-1); } try { FileInputStream in = new FileInputStream(args[0]); FileOutputStream out = new FileOutputStream(args[1]); byte[] buf = new byte[512]; int count; while ((count = in.read(buf)) > 0) { out.write(buf, 0, count); } in.close(); out.close(); } catch (IOException e) { e.printStackTrace(); } } }