黑马程序员技术交流社区
标题:
通过流来打印
[打印本页]
作者:
liyeming
时间:
2016-1-21 23:22
标题:
通过流来打印
package day21;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
public class InputStreamreader {
/**
* @param args
* @throws IOException
*/
public static void main(String[] args) throws IOException {
InputStreamReader isr = new InputStreamReader(new FileInputStream("aaa.txt"),"utf-8");
OutputStreamWriter osw = new OutputStreamWriter(new FileOutputStream("bbb.txt"),"gbk");
int b;
while((b = isr.read()) != -1){
osw.write(b);
}
isr.close();
osw.close();
}
}
欢迎光临 黑马程序员技术交流社区 (http://bbs.itheima.com/)
黑马程序员IT技术论坛 X3.2