一、代码如下
package www.tainiu.wenjian;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.lang.Character.UnicodeBlock;
public class ae__FileString__V1 {
public static void main(String[] args) {
// TODO Auto-generated method stub
FileReader fr= null;
FileWriter fw= null;
try {
fr= new FileReader("d:\Test.txt");
fw= new FileWriter("e:\Test.txt");
String test= "jst";
String test2= "jst讲解";
String s= null;
char[] chars= new char[1024];
int n= 0;
while((n=fr.read(chars)) != -1) {
// s= new String(chars);
// String newString= new String(s.getBytes(), "gbk");
// String utf8= new String(newString.getBytes("UTF-8"));
// String gbk1= new String(utf8.getBytes("GBK"));
//String newString_V2= new String(unicode.);
// System.out.println(gbk1);
//fw.write(chars, 0, n);
fw.write(chars);
// fw.write(gbk1);
}
//fw.write(chars);
//fw.write(test);
//fw.write(test2);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
} finally {
try {fr.close();fw.close();} catch (Exception e1) {e1.printStackTrace();}
}
}
}