FileWriter: write(int i)

public void write(int c) throws IOException
Write a single character. The character to be written is contained in the 16 low-order bits of the given integer value; the 16 high-order bits are ignored.

import java.io.FileReader;
import java.io.FileWriter;

//copy file
public class MainClass {

  public static void main(String args[]) {

    try {

      FileReader fr = new FileReader(args[0]);

      FileWriter fw = new FileWriter(args[1]);

      int i;
      while ((i = fr.read()) != -1) {
        fw.write(i);
      }
      fw.close();

      fr.close();
    } catch (Exception e) {
      System.out.println("Exception: " + e);
    }
  }
}
Home 
  Java Book 
    File Stream  

FileWriter:
  1. FileWriter
  2. new FileWriter(File file)
  3. new FileWriter(String string)
  4. new FileWriter(String fileName, boolean append)
  5. FileWriter: close()
  6. FileWriter: flush()
  7. FileWriter: write(int i)