CSV encode to ByteBuffer? #100
-
I would like to CSV Encode records of data to a ByteBuffer without any buffering that when the buffer reaches a specific size it will go through other processing steps like compression, BASE64 encoding and transmission that all work on ByteBuffers. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
A StringWriter is usually used for demonstration purposes only. The usual use pattern (write to a CSV file) is based on an OutputStreamWriter (see
You may simply try it by changing the implementation of Then do extensive JMH benchmarks. |
Beta Was this translation helpful? Give feedback.
A StringWriter is usually used for demonstration purposes only. The usual use pattern (write to a CSV file) is based on an OutputStreamWriter (see
CsvWriter.CsvWriterBuilder#build(java.nio.file.Path, java.nio.file.OpenOption...)
).You may simply try it by changing the implementation of
CsvWriter.FastBufferedWriter
to use a ByteBuffer/CharBuffer instead of achar[] buf
and aWritableByteChannel
instead of aWriter
.Then do extensive JMH benchmarks.