Well most of the code is working fine, but when it starts to enther the while loop it just over shoots it completly. I had tested it outside of the if statement and it works fine there, but when I put it in the if statement it just wont enter the while loop at all. What am I not seeing here?
if(input == 2)
        {
            try{
            //read in file
            //input streams
            FileInputStream fis = new FileInputStream("Book-text.dat");
            BufferedInputStream bis = new BufferedInputStream(fis);
            DataInputStream dis = new DataInputStream(bis);
            System.out.println("From Book-Text.dat");
 
             // dis.available() returns 0 if the file does not have more lines.
            System.out.println("Entering while");
            //not entering while statement Why!
            while(dis.available() != 0)
            {
            // this statement reads the line from the file and print it to
              // the console.
                System.out.println("In while");
                System.out.println(dis.readLine());
            }
 
            // dispose all the resources after using them.
            System.out.println("Exit Whie");
            fis.close();
            bis.close();
            dis.close();
            System.out.println("Close Streams");
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
 
 
            //read object file
            //this works fine
 
         try {
 
            //Construct the ObjectInputStream object
            ObjectInputStream inputStream = new ObjectInputStream(new FileInputStream("Book-objects.dat"));
            Object obj = null;
            System.out.println("From Book-Object.dat");
 
            while ((obj = inputStream.readObject()) != null) {
 
                if (obj instanceof Book) {
 
 
                    System.out.println(((Book)obj).toString());
                }
 
            }
             inputStream.close();
 
 
        } catch (EOFException ex) { //This exception will be caught when EOF is reached
            System.out.println("End of file reached.");
        } catch (ClassNotFoundException ex) {
            ex.printStackTrace();
        } catch (FileNotFoundException ex) {
            ex.printStackTrace();
        } catch (IOException ex) {
            ex.printStackTrace();
        }
 
        }//end of view if