- public static void show1() throws Exception {
- FileReader fr = null;
- FileWriter fw = null;
- try {
- fr = new FileReader("f:\\2013\\demo.java");
- fw = new FileWriter("f:\\2013\\demo1.java");
- char[] bur = new char[1024];
- int len;
- while (-1 != (len = fr.read(bur))) {
- fw.write(bur, 0, len);
- }
- } catch (RuntimeException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } finally {
- if (fr != null)
- fr.close();
- if (fw != null)
- fw.close();
- }
- }
复制代码 为什么复制出的文件打开后汉字是乱码呢!难道用的码表不同?
|