需要读取的.txt文本
读取后的.txt文本
求代码,谢谢各位大佬
需要读取的.txt文本
读取后的.txt文本
求代码,谢谢各位大佬
收起
public static void main(String[] args) throws Exception {
File file = new File("readFilePath");
BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(new File("outFilePath")),"UTF-8"));
BufferedInputStream inputStream = new BufferedInputStream(new FileInputStream(file));
BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream),5*1024*1024);
String line = null;
if((line = reader.readLine()) != null) {
String[] infoArraay = line.split("\t");
writer.write(infoArraay[0]+"\t"+infoArraay[1]);
writer.newLine();
}
while((line = reader.readLine()) != null) {//逐行的读
String[] infoArraay = line.split("\t");
writer.write(infoArraay[0]+","+infoArraay[1]);
writer.newLine();
}
reader.close();
writer.close();
}
报告相同问题?