日期:2014-05-20 浏览次数:20675 次
public static void copy3(){
BufferedInputStream frs=null;
BufferedOutputStream fws=null;
try {
frs=new BufferedInputStream(new InputStreamReader(new FileInputStream("C:\\Documents and Settings\\Administrator\\桌面\\22.txt"),"UTF-8"))//目前这个地方报错,应该如何修改呢
fws=new BufferedOutputStream(new OutputStreamWriter(new FileOutputStream("C:\\Documents and Settings\\Administrator\\桌面\\11.txt"),"UTF-8"));//目前这个地方报错,应该如何修改呢
byte[] bt=new byte[1024];
int len=0;
while((len=frs.read(bt))!=-1){
fws.write(bt,0,len);
}
} catch (Exception e) {
throw new RuntimeException("读取错误");
}finally{
try {
if(frs!=null)
frs.close();
} catch (Exception e2) {
throw new RuntimeException("读错误");
}
try {
if(fws!=null)
fws.close();
} catch (Exception e3) {
throw new RuntimeException("写错误");
}
}
}