Actually, why not just pass the raw `PrintWriter` to `transform`?  It would simplify `transform`'s signature and provide a lot of flexibility without sacrificing performance.

This would efficiently support the case where you want to write a reducer's input as a key followed by one value per line (with appropriate delimiters between keys) because it wouldn't force you to append `'\n'` to the end of each value's string before printing it.