使用BufferedReader和BufferedWriter的缓冲副本
//from n o w j a v a . c o m - 时 代 Java import java.io.FileReader; import java.io.FileWriter; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; public class BufferedCopy { public static void main(String[] args) throws IOException { BufferedReader inputStream = null; BufferedWriter outputStream = null; try { inputStream = new BufferedReader(new FileReader("xanadu.txt")); outputStream = new BufferedWriter(new FileWriter( "characteroutput.txt"));/**from N o w J a v a . c o m**/ int c; while ((c = inputStream.read()) != -1) { outputStream.write(c); } } finally { if (inputStream != null) { inputStream.close(); } if (outputStream != null) { outputStream.close(); } } } }