public byte[] toByteArray(){
  byte newbuf[]=new byte[_count];
  System.arraycopy(_buffer,0,newbuf,0,_count);
  return newbuf;
}

public byte [ ] toByteArray ( ) { byte newbuf [ ] = new byte [ _count ] ; System . arraycopy ( _buffer , 0 , newbuf , 0 , _count ) ; return newbuf ; }
creates a newly allocated byte array . its size is the current size of this output stream and the valid contents of the buffer have been copied into it .
