日期:2014-05-20 浏览次数:21478 次
public static void convertUTFFileToGBKFile(String srcFileName, String destFileName) {//把文件转换为GBK文件 BufferedReader br = null; ; BufferedWriter bw = null; try { br = new BufferedReader(new InputStreamReader(new FileInputStream( srcFileName), "utf-8")); bw = new BufferedWriter(new OutputStreamWriter( new FileOutputStream(destFileName), "gbk")); String line = null; while ((line = br.readLine()) != null) { bw.write(line); bw.newLine(); } } catch (Exception e) { } finally { try { if (br != null) br.close(); if (bw != null) bw.close(); } catch (IOException e) { } } }