public synchronized void writeTo (OutputStream out) throws IOException

Writes the complete contents of this byte array output stream to the specified output stream argument, as if by calling the output stream's write method using out.write(buf, 0, count).

Parameters:
out    the output stream to which to write the data.

Exceptions:
IOException    if an I/O error occurs.