OutStreamWriter和InputStreamReader具体使用
InputStreamReader isr;
OutputStreamWriter osw;
{
try{
isr = new InputStreamReader(new FileInputStream("a.txt"), "utf-8");
int tmp = -1;
while((tmp = isr.read()) != -1){
System.out.println((char)tmp);
}
osw = new OutputStreamWriter(new FileOutputStream("b.txt"), "utf-8");
osw.write("你好");
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally{
try {
isr.close();
osw.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}