BufferedReader reader = null;
BufferedWriter writer = null;
try {
// 有08.import java.util.List;的代码txt 该txt最好是UTF-8格式的,否则中文会乱码
reader = new BufferedReader(new FileReader("d:\\11.txt"));
// 去除08.的代码文件 文件格式是utf-8的
writer = new BufferedWriter(new FileWriter("d:\\11NEW.txt"));
String line = null;
do{
line = reader.readLine();
if (line != null){
System.out.println(line.substring(3));
writer.write(line.substring(3));
writer.newLine();
}
}while(line != null);
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}finally{
if (null != reader){
try {
reader.close();
} catch (IOException e) {
e.printStackTrace();
}
}
if (null != writer){
try {
writer.flush();
writer.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
BufferedWriter writer = null;
try {
// 有08.import java.util.List;的代码txt 该txt最好是UTF-8格式的,否则中文会乱码
reader = new BufferedReader(new FileReader("d:\\11.txt"));
// 去除08.的代码文件 文件格式是utf-8的
writer = new BufferedWriter(new FileWriter("d:\\11NEW.txt"));
String line = null;
do{
line = reader.readLine();
if (line != null){
System.out.println(line.substring(3));
writer.write(line.substring(3));
writer.newLine();
}
}while(line != null);
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}finally{
if (null != reader){
try {
reader.close();
} catch (IOException e) {
e.printStackTrace();
}
}
if (null != writer){
try {
writer.flush();
writer.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}