Joerg Heinicke wrote:
On 02.06.2008 05:56, Sylvain Wallez wrote:
Stupid question: why do we need a special BufferedOutputStream?

For being able to reset the response buffer for error handling. This is also possible with java.io.BufferedOutputStream, if the buffer size is big enough (current default value is 1MB), but then the buffer byte[] is always that big rather than increasing. That's what's happening right now, if you don't specify -1 as buffer size. -1 means complete buffering which on the other hand might lead to OutOfMemoryError [1]. In addition our BOS counts the bytes so that we can use the value to set the content length header.

Joerg

[1] https://issues.apache.org/jira/browse/COCOON-2168

Out of interest, have you raised an enhancement request and/or a patch with the OpenJDK project[1]? It seems to me this "increasing buffer" behaviour would be useful more generally...


Andy.

[1] http://openjdk.java.net/
--
http://pseudoq.sourceforge.net/  Open source Sudoku solver

Reply via email to