public class Name {
@SuppressWarnings("resource")
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new FileReader("Name.txt"));
BufferedWriter bw = new BufferedWriter(new FileWriter("Copy_Name"));
StringBuffer sb = new StringBuffer();
ArrayList<StringBuffer> arrayList = new ArrayList<>();
String s=null;
while ((s=br.readLine())!=null) {
sb.append("<li>").append(s).append("<li>").append("\r\n");
arrayList.add(sb);
System.out.println(sb);
}
for (int i = 0; i < arrayList.size(); i++) {
//StringBuffer sb=bw.write(arrayList.get(i));此处怎么解决?
}
}
} |
|