title: Convert OutputStream to ByteArrayOutputStream
body: <p>I am trying to convert an <code>OutputStream</code> to a <code>ByteArrayOutput</code> Stream.  I was unable to find any clear simple answers on how to do this.  This question was asked in the title of the question on StackOverflow, but the body of the question aske how to change a <code>ByteArrayStream</code> to <code>OuputStream</code>.  I have an <code>OutputStream</code> that is already created and this example given in the answer will not compile!</p>
  
  <p><a href="https://stackoverflow.com/questions/5878632/bytearrayoutputstream-from-outputstream">That Question is Here</a></p>
  
  <p>I have an OutputStream that is already constructed and has a length of 44 bytes called waveHeader.  I want to convert that to a ByteArrayOutputStream because I want to be able to change that into a byte[] with waveHeader.ToByteArray() for simplicity in later processes;</p>
  
  <p>Is there a simple type of casting or something that will allow this? </p>
  
  <p>If not then:</p>
  
  <ul>
  <li><p>Is there a way to construct a pointer to the data in the original OutputStream if it is not possible to convert it? </p></li>
  <li><p>How would someone go about accessing the data that is contained in the OutputStream?</p></li>
  </ul>
  
  <p>I am new to JAVA. This is just a hobby for me. Streams In VisualBasic .net where much easier!</p>