Ultimato il sistema di restore del contatore oggetti inseriti id

This commit is contained in:
2013-12-18 01:18:34 +01:00
parent 40157c8ccf
commit 929fe8aaaa
3 changed files with 21 additions and 1 deletions

View File

@@ -23,7 +23,19 @@ public class IdCounter {
}
public static void restore_counter() throws FileNotFoundException,IOException,ClassNotFoundException{
File f_data = new File("id_counter");
if ( (f_data.exists())){
ObjectInputStream reader = new ObjectInputStream(new FileInputStream(f_data));
Integer data = (Integer) reader.readObject();
Global.setGeneral_counter(data.intValue());
}else{
Global.setGeneral_counter(0);
}
}
}