// https://www.tutorialspoint.com/java/java_files_io.htm
import java.io.*;
public class StreamCharsCopyFile {
    public static void main(String args[]) throws IOException {
      FileReader in = null;
      FileWriter out = null;
      try {
          in = new FileReader("input.txt");
          out = new FileWriter("output.txt");
          int c; // int que leera un byte
          while ((c = in.read()) != -1) {
              out.write(c);
          }
      } finally {
          if (in != null) {
              in.close();
          }
          if (out != null) {
              out.close();
         }
      }
   }
}
/* Though internally FileReader uses FileInputStream and FileWriter uses
 * FileOutputStream but here the major difference is that FileReader reads two
 * bytes at a time and FileWriter writes two bytes at a time. */
