title: Java Serialization Object
body: <p>For my android studio project I need to serialize a User object. The idea is to save and load this object, so when the application is closes (gets destroyed) the objects and it's attributes are saved and stored in a file. My problem is that I'm getting an error with loading the object. It's says there is no such file or directory named 'save.bin', although I tried to create it. Here is my code:</p>
  
  <pre><code>    public class SaveAndLoadManager{
          public void save(Object object){
              Log.d("Save", "saving object");
              try{
                  File userInfo = new File("save.bin");
                  FileOutputStream fileOutputStream = new FileOutputStream(userInfo);
                  ObjectOutputStream objectOutputStream = new ObjectOutputStream(fileOutputStream);
                  objectOutputStream.writeObject(object);
                  objectOutputStream.close();
                  Log.d("Save", "object saved");
              }catch(FileNotFoundException e){
                  Log.e("Save", e.getMessage());
              }catch(IOException e){
                  Log.e("Save", e.getMessage());
              }
          }
          public Object load(){
              Log.d("Load", "loading object");
              Object object = null;
              try{
                  FileInputStream fileInputStream = new FileInputStream("save.bin");
                  ObjectInputStream objectInputStream = new ObjectInputStream(fileInputStream);
                  object = objectInputStream.readObject();
                  objectInputStream.close();
                  Log.d("Load", "object loaded");
              }catch(FileNotFoundException e){
                  Log.e("Load", e.getMessage());
              }catch(StreamCorruptedException e){
                  Log.e("Load", e.getMessage());
              }catch(Exception e){
                  Log.e("Load", e.getMessage());
              }
              return object;
          }
      }
  </code></pre>
  
  <p>How do I properly create a directory?</p>