jackson-dataformats-text
jackson-dataformats-text copied to clipboard
FIX #45 Option to skip ending line break (csv)
Ok. Thank you for submitting this! It'd be great if logic would prevent outputting instead of trying to undo addition as undo seems bit error-prone. I'll see if that is doable.
You're totally right @cowtowncoder. I tried that way first but it seemed to me to be more confusing. One reason is that you have to know when you reach the last line or not.
wow, this is open for a very long time.... I actually do need this...
It'd be good to resolve the conflict, could consider merging.
@mathieu-lavigne Apologies for dropping the ball on this. I think this would work, as CsvEncoder.endRow()
does guarantee that linefeed is not split on output buffer boundary. There may be some edge cases still (someone calling CsvGenerator.flush()
at the end before close()
...) but that is probably acceptable considering how difficult alternative is (that of trying to change how linefeed is added).
But I'd like one bigger change: instead of CsvSchema
, I think this really works better as CsvGenerator.Feature
.
There's also need for a unit test or two.
With those I'd be happy to merge this for 2.17.
I realize you may not have time or interest after this delay; if not, I understand. And can then proceed with a new PR.
Created new PR #453 to implement as generator feature.
Found couple of issues wrt implementation -- generator.flush()
will prevent it from working, basically -- but aside from that works ok (added couple of basic tests).