输入输出文件
来源:互联网 发布:化妆品成分查询软件 编辑:程序博客网 时间:2024/05/01 11:13
String path = "D:\\bak";
String outPath = "D:\\";
FileWriter fw = null;
OutputStreamWriter outputStream = null;
FileOutputStream fileOutputStream = null;
BufferedReader reader = null;
File file = new File(path);
File[] files = file.listFiles();
int line = 0;
for (int i = 0; i < files.length; i++) {
String filePath = files[i].getPath();
String fileName = files[i].getName();
// reader = new BufferedReader(new FileReader(new File(filePath)));
FileInputStream fr = new FileInputStream(filePath);
InputStreamReader is = new InputStreamReader(fr, "UTF-8");
reader = new BufferedReader(is);
String tempString = "";
String str = "";
while ((tempString = reader.readLine()) != null) {
if (!"".equals(tempString) && tempString.indexOf("hhhj") == -1) {
// String[] strs = tempString.split("\\|#\\$\\|");
// for (int j = 0; j < strs.length; j++) {
// System.out.println(strs[j]);
// }
fileOutputStream = new FileOutputStream(outPath+fileName,true);
outputStream = new OutputStreamWriter(fileOutputStream, "UTF-8");
outputStream.write(tempString);
outputStream.write("\r\n");
outputStream.flush();
}
line++;
}
}
String outPath = "D:\\";
FileWriter fw = null;
OutputStreamWriter outputStream = null;
FileOutputStream fileOutputStream = null;
BufferedReader reader = null;
File file = new File(path);
File[] files = file.listFiles();
int line = 0;
for (int i = 0; i < files.length; i++) {
String filePath = files[i].getPath();
String fileName = files[i].getName();
// reader = new BufferedReader(new FileReader(new File(filePath)));
FileInputStream fr = new FileInputStream(filePath);
InputStreamReader is = new InputStreamReader(fr, "UTF-8");
reader = new BufferedReader(is);
String tempString = "";
String str = "";
while ((tempString = reader.readLine()) != null) {
if (!"".equals(tempString) && tempString.indexOf("hhhj") == -1) {
// String[] strs = tempString.split("\\|#\\$\\|");
// for (int j = 0; j < strs.length; j++) {
// System.out.println(strs[j]);
// }
fileOutputStream = new FileOutputStream(outPath+fileName,true);
outputStream = new OutputStreamWriter(fileOutputStream, "UTF-8");
outputStream.write(tempString);
outputStream.write("\r\n");
outputStream.flush();
}
line++;
}
}
- 输入输出文件
- 输入输出文件
- 文件输入输出
- 文件输入输出
- 文件输入输出
- 文件输入输出
- 文件输入输出
- 文件输入输出
- 文件输入输出
- 文件输入输出
- 文件输入输出&文件模式
- LINUX输入输出与文件
- 文件的输入输出函数
- 输入输出文件的缓冲区
- linux文件输入输出
- C++文件输入输出
- 输入输出文件流
- linux文件输入输出
- prototype的理解!
- 受邀参加CSDN南京“电子商务、云计算、移动互联网的新模式新技术分享”活动-南京徐庄软件园
- 二叉树1
- emacs 安装 CEDET ECB 笔记
- [ProblemSolving]ut下载磁盘负荷过重
- 输入输出文件
- 第0章 无中生有
- 二叉树及按层遍历的算法实现
- 王爽汇编第十章课程设计精简设计~(整理)
- 顺序查找
- HDU 1247:Hat’s Words(字典树)
- 折半查找
- 用visio画UML图
- HDU3995 最小包围圆变形