title: ByteArrayInputStream to ObjectInputStream disappeared
body: <p>I've something that I don't understand, please help.</p>
  
  <pre><code>System.out.println("\n" + Arrays.toString(buffer) + "\n");
  System.out.println("buffer.length = " + buffer.length + "\nnew ByteArrayInputStream(buffer).available() is: " + new ByteArrayInputStream(buffer).available());
  ObjectInput input = new ObjectInputStream(new ByteArrayInputStream(buffer));
  System.out.println("input.available(): " + input.available());
  </code></pre>
  
  <p>Its output is below:</p>
  
  <pre><code>[-84, -19, 0, 5]
  
  buffer.length = 4
  new ByteArrayInputStream(buffer).available() is: 4
  input.available(): 0
  </code></pre>
  
  <p>I'm so confused why a byte array of 4 valid bytes, after putting into ObjectInputStream, it becomes zero.</p>
  
  <p>Things I've tried:</p>
  
  <ol>
  <li>Initially, I was doubting my byte array was empty, but as you see, I printed out, its length is 4.</li>
  <li>Then I thought my byte might be invalid, so I printed out each byte, as you can see, those four bytes are all valid.</li>
  </ol>
  
  <p>So, I'm lost why this is happening.</p>
  
  <p>Please help, thanks a lot!</p>