特定のファイルの「voted:」行を読み取り、その後の番号をチェックするコードを作成する必要があります。次に、この番号を取得し、それに 1 を追加して、ファイルに出力する必要があります。これが私がこれまでに持っているものです:
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 + "!");
それで、どうすればこれを行うことができますか?