package IsPackage;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
public class IsrAndOswDemo {
public static void main(String[] args) throws IOException {
FileInputStream in = new FileInputStream("e:\\javaio\\imooc.txt");
InputStreamReader isr = new InputStreamReader(in);
int c;
while((c = isr.read())!=-1){
System.out.print((char)c);
}
char[] buffer = new char[8*1024];
//int c;
//while((c=isr.read(buffer,0,buffer.length))!=-1){
//String s= new String(buffer,0,c);
//System.out.print(s);
//
//}
FileOutputStream out = new FileOutputStream("e:\\javaio\\imooc2.txt");
OutputStreamWriter osw = new OutputStreamWriter(out, "utf-8");
while((c=isr.read(buffer,0,buffer.length))!=-1){
String s = new String(buffer,0,c);
//System.out.print(s);
osw.write(buffer,0,c);
osw.flush();
}
osw.close();
isr.close();
}
}