2014-12-04 14:11 GMT+01:00 Mark Thomas <ma...@apache.org>: > The used flag is only ever set to true. It needs to be reset to false > after a write to avoid multiple flush() calls one after the other > triggering empty writes. > > Looking at the code, what would be better is if something along the > lines of using buffer.flip(), buffer.remaining(). > > I'm looking at the code now so I'll put a test case and a patch together. > > I made one further commit on this, but it is lost in limbo at the moment. I would recommend not touching anything for now. The purpose of the flag is so that close always writes a last part unless nothing was ever written. I did add a if (buffer.position > 0) in flush to avoid useless empty writes.
Rémy