common/src/main/java/HTTPClient/HttpOutputStream.java
/**
     * Writes an array of bytes on the stream. This method may not be used
     * until this stream has been passed to one of the methods in
     * HTTPConnection (i.e. until it has been associated with a request).
     *
     * @param buf an array containing the data to write
     * @param off the offset of the data whithin the buffer
     * @param len the number bytes (starting at <var>off</var>) to write
     * @exception IOException if any exception is thrown by the socket, or
     *            if writing <var>len</var> bytes would cause more bytes to
     *            be written than this stream is willing to accept.
     * @exception IllegalAccessError if this stream has not been associated
     *            with a request yet
     */
Writes an array of bytes on the stream. This method may not be used
until this stream has been passed to one of the methods in
HTTPConnection .

@param buf an array containing the data to write
@param off the offset of the data whithin the buffer
@param len the number bytes (starting at off) to write
@exception IOException if any exception is thrown by the socket, or
if writing len bytes would cause more bytes to
be written than this stream is willing to accept.
@exception IllegalAccessError if this stream has not been associated
with a request yet
Writes an array of bytes on the stream . This method may not be used until this stream has been passed to one of the methods in HTTPConnection . @param buf an array containing the data to write @param off the offset of the data whithin the buffer @param len the number bytes ( starting at off ) to write @exception IOException if any exception is thrown by the socket or if writing len bytes would cause more bytes to be written than this stream is willing to accept . @exception IllegalAccessError if this stream has not been associated with a request yet
public synchronized void write(byte[] buf, int off, int len)
	    throws IOException, IllegalAccessError
    {
	if (req == null)
	    throw new IllegalAccessError("Stream not associated with a request");
	if (ignore) return;
	if (length != -1  &&  rcvd+len > length)
	{
	    IOException ioe =
		new IOException("Tried to write too many bytes (" + (rcvd+len) +
				" > " + length + ")");
	    req.getConnection().closeDemux(ioe, false);
	    req.getConnection().outputFinished();
	    throw ioe;
	}
	try
	{
	    if (bos != null)
		bos.write(buf, off, len);
	    else if (length != -1)
		os.write(buf, off, len);
	    else
		os.write(Codecs.chunkedEncode(buf, off, len, null, false));
	}
	catch (IOException ioe)
	{
	    req.getConnection().closeDemux(ioe, true);
	    req.getConnection().outputFinished();
	    throw ioe;
	}
	rcvd += len;
    }
public synchronized void write ( byte [ ] buf , int off , int len ) throws IOException , IllegalAccessError { if ( req == null ) throw new IllegalAccessError ( "Stream not associated with a request" ) ; if ( ignore ) return ; if ( length != - 1 && rcvd + len > length ) { IOException ioe = new IOException ( "Tried to write too many bytes (" + ( rcvd + len ) + " > " + length + ")" ) ; req . getConnection ( ) . closeDemux ( ioe , false ) ; req . getConnection ( ) . outputFinished ( ) ; throw ioe ; } try { if ( bos != null ) bos . write ( buf , off , len ) ; else if ( length != - 1 ) os . write ( buf , off , len ) ; else os . write ( Codecs . chunkedEncode ( buf , off , len , null , false ) ) ; } catch ( IOException ioe ) { req . getConnection ( ) . closeDemux ( ioe , true ) ; req . getConnection ( ) . outputFinished ( ) ; throw ioe ; } rcvd += len ; }
Writes an array of bytes on the stream.
Writes an array of bytes on the stream .