try {
BufferedInputStream bis = new BufferedInputStream(new FileInputStream(new File("d:/wrapper.log")));//fileinputstream 文件流 bufferedinputstream 文件缓冲流可以提高文件流性能
BufferedReader in = new BufferedReader(new InputStreamReader(bis, "utf-8"), 10 * 1024 * 1024);//10M缓存//bufferedreader 由reader扩展而来,缓冲读取文本流,提供使用的
FileWriter fw = new FileWriter("d://abc.txt"); //inputstreamreader 字节流转字符流的桥梁
while (in.ready()) {
String line = in.readLine();
fw.append(line + " ");
}
in.close();
fw.flush();
fw.close();
} catch (IOException ex) {
ex.printStackTrace();
}
BufferedInputStream bis = new BufferedInputStream(new FileInputStream(new File("d:/wrapper.log")));//fileinputstream 文件流 bufferedinputstream 文件缓冲流可以提高文件流性能
BufferedReader in = new BufferedReader(new InputStreamReader(bis, "utf-8"), 10 * 1024 * 1024);//10M缓存//bufferedreader 由reader扩展而来,缓冲读取文本流,提供使用的
FileWriter fw = new FileWriter("d://abc.txt"); //inputstreamreader 字节流转字符流的桥梁
while (in.ready()) {
String line = in.readLine();
fw.append(line + " ");
}
in.close();
fw.flush();
fw.close();
} catch (IOException ex) {
ex.printStackTrace();
}