我需要编写一些代码来读取“已投票:”行的某个文件,然后检查它后面的数字。然后它需要获取这个数字,向其中添加一个,然后将其打印回文件中。这是我到目前为止所拥有的:
try{
File yourFile = new File(p + ".vote");
if(!yourFile.exists()) {
yourFile.createNewFile();
}
FileOutputStream oFile = new FileOutputStream(yourFile, false);
this.logger.info("A vote file for the user " + p + " has been created!");
} catch(Exception e) {
this.logger.warning("Failed to create a vote file for the user " + p + "!");
那么,我该怎么做呢?