zoo_app/app/src/main/java/com/example/jhalloran/zoo/io/ZooFileManager.java
public synchronized void initializeZooFromFile() {
    try {
      FileInputStream fis = context.openFileInput(FILE_NAME);
      ObjectInputStream ois = new ObjectInputStream(fis);
      Zoo zoo = (Zoo) ois.readObject();
      ois.close();
      fis.close();
      if (zoo != null) {
        Zoo.initializeZoo(zoo);
        Log.i(TAG, String.format("%s initialized from file", zoo.getName()));
      }
    } catch (IOException | ClassNotFoundException e) {
      e.printStackTrace();
    }
  }
/**
   * Reads data from file and initializes saved Zoo.
   */
Reads data from file and initializes saved Zoo.
Reads data from file and initializes saved Zoo .
public synchronized void initializeZooFromFile() {
    try {
      FileInputStream fis = context.openFileInput(FILE_NAME);
      ObjectInputStream ois = new ObjectInputStream(fis);
      Zoo zoo = (Zoo) ois.readObject();
      ois.close();
      fis.close();
      if (zoo != null) {
        Zoo.initializeZoo(zoo);
        Log.i(TAG, String.format("%s initialized from file", zoo.getName()));
      }
    } catch (IOException | ClassNotFoundException e) {
      e.printStackTrace();
    }
  }
public synchronized void initializeZooFromFile ( ) { try { FileInputStream fis = context . openFileInput ( FILE_NAME ) ; ObjectInputStream ois = new ObjectInputStream ( fis ) ; Zoo zoo = ( Zoo ) ois . readObject ( ) ; ois . close ( ) ; fis . close ( ) ; if ( zoo != null ) { Zoo . initializeZoo ( zoo ) ; Log . i ( TAG , String . format ( "%s initialized from file" , zoo . getName ( ) ) ) ; } } catch ( IOException | ClassNotFoundException e ) { e . printStackTrace ( ) ; } }
Reads data from file and initializes saved Zoo.
Reads data from file and initializes saved Zoo .