Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void writetodisk()
- {
- try
- {
- FileOutputStream fileOut =
- new FileOutputStream("plugins/tokendata.txt");
- ObjectOutputStream out = new ObjectOutputStream(fileOut);
- out.writeObject(map);
- out.close();
- fileOut.close();
- System.out.printf("Serialized data is saved in data.txt");
- }catch(IOException i)
- {
- i.printStackTrace();
- }
- }
- @SuppressWarnings("unchecked")
- public void readfromdisk () {
- try
- {
- FileInputStream fileIn =
- new FileInputStream("plugins/tokendata.txt");
- ObjectInputStream in = new ObjectInputStream(fileIn);
- map = (HashMap<UUID, Integer>) in.readObject();
- in.close();
- fileIn.close();
- System.out.printf("Serialized data is saved in data.txt");
- }catch(IOException i)
- {
- i.printStackTrace();
- }
- catch(ClassNotFoundException c)
- {
- System.out.println("Class not found");
- c.printStackTrace();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement