Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- To load:
- @SuppressWarnings("rawtypes")
- public static void saveHM(HashMap hm, String s) {
- try {
- File file = new File("data/data/at.enagon.micromon.main", s);
- FileOutputStream fos = new FileOutputStream(file);
- ObjectOutputStream oos = new ObjectOutputStream(fos);
- oos.writeObject(hm);
- oos.flush();
- oos.close();
- fos.close();
- } catch (FileNotFoundException e) {
- e.printStackTrace();
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- To save:
- @SuppressWarnings("rawtypes")
- public static HashMap loadHM(String s) {
- try {
- File file = new File("data/data/at.enagon.micromon.main", s);
- FileInputStream fis = new FileInputStream(file);
- ObjectInputStream ois = new ObjectInputStream(fis);
- Object o = ois.readObject();
- HashMap hm = (HashMap) o;
- ois.close();
- fis.close();
- return hm;
- } catch (IOException e) {
- e.printStackTrace();
- } catch (ClassNotFoundException e) {
- e.printStackTrace();
- }
- return null;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement