title: ByteArrayInputStream does not copy the byte array?
body: <p>The Documentation on ByteArrayInputStream says :</p>
  
  <blockquote>
    <p>java.io.ByteArrayInputStream.ByteArrayInputStream(byte[] buf)
    Creates a ByteArrayInputStream so that it uses buf as its buffer array. The buffer array is not copied. The initial value of pos is 0 and the initial value of count is the length of buf.
    Parameters:
    buf the input buffer.</p>
  </blockquote>
  
  <p>When I run the below code , </p>
  
  <pre><code>        byte[] b = new byte[10];
      ByteArrayInputStream bais = new ByteArrayInputStream(b);
      String someText = "Java byte arrayinput stream test - this string will be used.";
      b = someText.getBytes();
  
      int c =0;
      while( ( c = bais.read()) != -1 ){
          System.out.print((char)c);
      }
  </code></pre>
  
  <p>the output I get is based on the 10 byte blank array, not the string used to test. This indicates that the constructor of ByteArrayInputStream must be copying the byte array rather than storing a reference to the passed byte array.This contradicts the documentation. Can anyone clarify my understanding , if the byte array is copied or not ?( and if it is not copied , then why the output does not reflect the state of byte array b ?</p>