hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sebastiaan van Erk <sebs...@sebster.com>
Subject ChunkedOutputStream and flushing
Date Wed, 02 Apr 2008 19:55:04 GMT
Hi,

I have a question on the chunked output stream: one of the nice things 
about chunked encoding is that you can send your data in little parts. 
However, flush() on ChunkedOutputStream does not flush the buffer:

     /**
      * Flushes the underlying stream, but leaves the internal buffer alone.
      * @throws IOException
      */
     public void flush() throws IOException {
         this.out.flush();
     }

This is kind of against the spec of flush on OutputStream:

     /**
      * Flushes this output stream and forces any buffered output bytes
      * to be written out. The general contract of <code>flush</code> is
      * that calling it is an indication that, if any bytes previously
      * written have been buffered by the implementation of the output
      * stream, such bytes should immediately be written to their
      * intended destination.
      * ...

I was wondering what the motivation was behind disabling the flush() 
option? Generally if a client does not want to flush the data they won't 
call flush, which will cause all the chunks to attain the full chunk 
size anyway...

Regards,
Sebastiaan


Mime
View raw message