public synchronized void writeTo(OutputStream out) throws IOException {
        int remaining = count;
        for (byte[] buf : buffers) {
            int c = Math.min(buf.length, remaining);
            out.write(buf, 0, c);
            remaining -= c;
            if (remaining == 0) {
                break;
            }
        }
    }
public synchronized void writeTo(OutputStream out) throws IOException {
        int remaining = count;
        for (byte[] buf : buffers) {
            int c = Math.min(buf.length, remaining);
            out.write(buf, 0, c);
            remaining -= c;
            if (remaining == 0) {
                break;
            }
        }
    }
public synchronized void writeTo ( OutputStream out ) throws IOException { int remaining = count ; for ( byte [ ] buf : buffers ) { int c = Math . min ( buf . length , remaining ) ; out . write ( buf , 0 , c ) ; remaining -= c ; if ( remaining == 0 ) { break ; } } }
Writes the entire contents of this byte stream to the
specified output stream.

@param out  the output stream to write to
@throws IOException if an I/O error occurs, such as if the stream is closed
@see java.io.ByteArrayOutputStream#writeTo(OutputStream)
Writes the entire contents of this byte stream to the specified output stream .