title: (Java) EOFException when reading from a Text File
body: <p>I am reading two strings and a double from a text file, but keep throwing an <code>EOFException</code>.
  This is my code:</p>
  
  <pre><code>public static Book readBook(String pathname) throws IOException, FileNotFoundException{
        DataInputStream dis = new DataInputStream(
                                  new BufferedInputStream(
                                      new FileInputStream(fn)));
        String theTitle = dis.readUTF();
        String theAuthor = dis.readUTF();
        double thePrice = dis.readInt();
        dis.close();
        return new Book(theTitle, theAuthor, thePrice);
     } 
  </code></pre>
  
  <p>Im really quite new to IO and have no idea on how to solve this exception, and throwing <code>EOFExecption</code> doesn't seem to work. Any help would be greatly appreciated, Cheers</p>
  
  <p>EDIT: Stack Trace + File Contents</p>
  
  <pre><code>Exception in thread "main" java.io.EOFException
      at java.io.DataInputStream.readFully(Unknown Source)
      at java.io.DataInputStream.readUTF(Unknown Source)
      at java.io.DataInputStream.readUTF(Unknown Source)
      at Model.readBook(Model.java:48)
      at Model.runApp(Model.java:17)
      at Main.main(Main.java:8)
  </code></pre>
  
  <p>File Contents</p>
  
  <p>name
  author
  10.00
  name2
  author2
  12.00</p>
  
  <p>(In file they are all on seperate lines)</p>