/**
* 写文件
* @param string
* @param toFile
*/
public static void writetoFile(String string,String toFile){
RandomAccessFile rf = null;
try {
System.out.println("续写状态,写文件开始>>>>>>>");
rf = new RandomAccessFile(toFile,"rw");
rf.seek(rf.length());
rf.writeBytes(string+"\n");
System.out.println("写文件结束>>>>>>>,文件名为:"+toFile);
} catch (IOException e) {
System.out.println("写入文件失败:Error ---->"+e.getMessage());
}finally{
if(rf!=null){
try {
rf.close();
} catch (IOException e) {
System.out.println("关闭rf失败:Error ---->"+e.getMessage());
}
}
}
}