//读取70开头的xml,gbk转成utf-8 //InputStream is = new FileInputStream(super.getFile());//文件读取 //InputStreamReader isr = new InputStreamReader(is, "gbk");//解码 String newfile = super.getFilePath()+"\\"+"70.xml"; OutputStream os = new FileOutputStream(newfile);//文件输出 OutputStreamWriter osw = new OutputStreamWriter(os, "utf-8");//开始编码 char[] c = new char[1024];//缓冲 int length = 0; while(true){ length = isr.read(c); if(length == -1){ break; } //System.out.println(new String(c, 0, length)); osw.write(c, 0, length); osw.flush(); } isr.close(); osw.close();