title: Difference between ByteArrayOutputStream and BufferedOutputStream
body: <p>Both  <code>ByteArrayOutputStream</code>  and  <code>BufferedOutputStream</code> do buffering by placing data in an array in memory. So my questions are</p>
  
  <ol>
  <li>what are the differences between these two.</li>
  <li>When to use <code>ByteArrayOutputStream</code> and when to use <code>BufferedOutputStream</code></li>
  </ol>
  
  <p>Can some one help me in above two questions as i am confused on this. </p>