Engineering Full Stack Apps with Java and JavaScript
Need to copy files with text content using FileReader and FileWriter.
FileReader and FileWriter are convenience classes when working with character files.
import java.io.*;
public class FileCopier {
public static void main(String[] args) throws IOException,
InterruptedException {
FileReader fr = new FileReader("myFile.txt");
FileWriter fw = new FileWriter("myFileOut.txt", true);
int b = fr.read();
while (b != -1) {
fw.write((char) b);
b = fr.read();
}
fw.close();
fr.close();
}
}