Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public boolean save() {
- try {
- ObjectOutputStream oos = new ObjectOutputStream(
- new FileOutputStream(getDbFileName()));
- oos.writeObject(this);
- oos.close();
- return true;
- } catch (IOException ex) {
- ex.printStackTrace();
- return false;
- }
- }
- public boolean load() {
- try {
- ObjectInputStream oos = new ObjectInputStream(new FileInputStream(
- getDbFileName()));
- Object obj = oos.readObject();
- BaseList<T> l = this.getClass().cast(obj);
- this.list = l.getList();
- this.nextId = l.nextId;
- oos.close();
- return true;
- } catch (IOException ex) {
- ex.printStackTrace();
- } catch (ClassNotFoundException e) {
- e.printStackTrace();
- }
- return false;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement