When looking at the code of JsonEncoder I see that flush() has an additional action besides passing the flush() call through to the underlying JsonGenerator: it also calls parser.processImplicitActions(). This is probably why the doc warns, "JsonEncoder buffers output, and data may not appear on the output until Flushable.flush() is called."
Unfortunately, flush() also calls flush() on the underlying JsonGenerator. This leads to the unfortunate situation where writing data could lead to bad performance due to repeated, unnecessary flushing of the OutputStream. My workaround is to create my own JsonGenerator manually, and disable the JsonGenerator.Feature.FLUSH_PASSED_TO_STREAM feature. However, it'd be a lot easier if there was a method on JsonEncoder which writes all remaining data without calling flush() on the underlying stream. What do you think? Thanks, Shannon
