On 06/29/2010 05:25 PM, Vladimir Blagojevic wrote:
Not sure if you guys are aware of this but pay attention if you are
extending FilterOutputStream. One would expect FilterOutputStream
implementation to filter all methods directly to some underlying
stream. However, rather than filter byte array writes directly to the
underlying stream FilterOutputStream modifies the expected behaviour
to write individual bytes instead.
Well, yes but to be fair the javadoc for FilterOutputStream.write(byte,
int, int) includes the following caveat which documents the behaviour
and explains the simple fix that is required:
* Note that this method does not call the <code>write</code> method
* of its underlying input stream with the same arguments. Subclasses
* of <code>FilterOutputStream</code> should provide a more efficient
* implementation of this method.
regards,
Andrew Dinn
-----------