title: Reading multiple lines from a byte stream
body: <p>I've noticed that whenever you use <code>FileOutputStream</code> with append as true, the object that is appended is placed on a different line. </p>
  
  <p>My question is how do you read multiple lines of data with <code>ObjectInputStream</code>. </p>
  
  <p>For ex:</p>
  
  <pre><code>public class StringBytes {
  
      public static void main(String[] args) throws Exception {
          String S1 = "Hi";
          String S2 = "\n"+"Bye";
          String file = "C:\\HiBye.out";
  
  
          FileOutputStream fileOutputStream = new FileOutputStream(file);
          ObjectOutputStream objectOutputStream = new ObjectOutputStream(fileOutputStream);
          objectOutputStream.writeObject(S1);
  
          fileOutputStream = new FileOutputStream(file,true);
          objectOutputStream = new ObjectOutputStream(fileOutputStream);
          objectOutputStream.writeObject(S2);
  
  
  
          FileInputStream fileInputStream = new FileInputStream(file);
          ObjectInputStream objectInputStream = new ObjectInputStream(fileInputStream);
  
          String SS = (String) objectInputStream.readObject();
          System.out.println(SS);
  
      }
  }
  </code></pre>
  
  <p>The output for the above is <code>Hi</code> since <code>Bye</code> is on a different line it is not read.
  I'm still a beginer so all help appreciated</p>