title: Java readObject previews data, but will not read or transfer it
body: <p>I can't seem to find a way to make <code>readObject()</code> transfer it's contents to an object variable.  When I step through the Load function I get to <strong>"temp = (HashMap) ois.readObject();"</strong> Before this line is executed I am able to see the <code>HashMap's</code> data that I've written with oos in the expressions window of <code>Eclipse</code> so I know the data is there, however when this line executes I'm jumped to the <code>IOException</code> catch with an <code>EOF</code>.  From what I've read this is expected, but I have not found a way to catch the EOF (loops with available() and <code>readObjectInt()</code> did not work).  I'm running this on an Android emulator.  Any suggestions would be appreciated.</p>
  
  <pre><code>public void Save(Pottylog data)
  {
      try 
      {
          FileOutputStream fos = openFileOutput("Plog", Context.MODE_PRIVATE);
          ObjectOutputStream oos = new ObjectOutputStream(fos);
          oos.writeObject(data.get());
          oos.close();
      }
      catch (FileNotFoundException ex)
      {
          ex.printStackTrace();
      }
      catch (java.io.IOException e)
      {
          e.printStackTrace();
      }
  }
  
  public HashMap&lt;String, Integer&gt; Load()
  {
      HashMap&lt;String, Integer&gt; temp = null;
  
      try 
      {
          FileInputStream fis = openFileInput("Plog");
          ObjectInputStream ois = new ObjectInputStream(fis);
          temp = (HashMap&lt;String, Integer&gt;) ois.readObject();
  
      } 
      catch (FileNotFoundException e) 
      {
          // TODO Auto-generated catch block
          e.printStackTrace();
          return null;
      } 
      catch (IOException e) 
      {
          // TODO Auto-generated catch block
          e.printStackTrace();
      } 
      catch (ClassNotFoundException e) 
      {
          // TODO Auto-generated catch block
          e.printStackTrace();
          return null;
      }
  
      return temp;
  }
  </code></pre>