1
2
3
4
5
6
7
8
9
10
11
12
13
14
public static void write(Word word) throws Exception{
File file = new File("tokenOut.txt");
if(!file.exists()){
System.out.println("file not exist!");
}else{
DataOutputStream out = new DataOutputStream(new FileOutputStream(file));
System.out.println("--->" + word.getMessage());
out.writeUTF(new String(word.getMessage().getBytes(), "UTF-8"));
}
}
中的out.writeUTF(new String(word.getMessage().getBytes(), "UTF-8"));
每次都把前面写的覆盖了,怎么办? |