title: EOFException on opening a buffered object stream
body: <p>I'm testing the <code>ObjectInputStream</code> and <code>ObjectOutputStream</code> classes<br>
  tried to warp both in buffered stream object ..</p>
  
  <pre><code>File file = new File("file.lel"); //Assuming the file exist and has data stored in it.   
  //will truncate file   
  try (ObjectOutputStream out = new ObjectOutputStream(new BufferedOutputStream(new FileOutputStream(file)));   
   ObjectInputStream in = new ObjectInputStream(new BufferedInputStream(new FileInputStream(file))) //Bad Practice!  
  ) {   
  SomeObject writeMe = new SomeObject(1, 2, 3, 50.5, 'k'); //Object with 3 ints, a double and a char    
  final double D = 30.3; //for testing   
  
  out.writeDouble(D);  
  out.writeObject(writeMe);   
  out.flush();   
  
  double DAgain = in.readDouble();   
  SomeObject readMe = (SomeObject)in.readObject();   
  readMe.printInfo();   
  }   
  
  //Some catch blocks...
  </code></pre>
  
  <p>But i'm getting EOFException on line 3 in the code above       </p>
  
  <pre><code>Exception in thread "main" java.io.EOFException //header loaded first .. ?!
  at java.io.ObjectInputStream$PeekInputStream.readFully(Unknown Source)
  at java.io.ObjectInputStream$BlockDataInputStream.readShort(Unknown Source)
  at java.io.ObjectInputStream.readStreamHeader(Unknown Source)
  at java.io.ObjectInputStream.&lt;init&gt;(Unknown Source)
  </code></pre>
  
  <p>When i removed the buffer stream objects, code worked .. i.e.      </p>
  
  <pre><code>try (ObjectOutputStream out = new ObjectOutputStream(new FileOutputStream(file));
   ObjectInputStream in = new ObjectInputStream(new FileInputStream(file))
  ) { ... }
  </code></pre>
  
  <p>Why this behavior? any idea?</p>