implementations of java.io.Writer with different trade-offs
Implementations of java.io.Writer
with different trade-offs.
java.io.OutputStreamWriter
is very flexible and supports any encoding. However its use of sun.nio.cs.StreamEncoder
can result in a noticeable overhead for small writes. It allocates a few temporary objects which for small writes can be noticeable. By addressing only special cases we can make optimizations based on different trade-offs.
Currently we only offer the following two classes:
com.github.marschall.writers.AsciiOutputStreamWriter
, only supports US-ASCII.com.github.marschall.writers.BufferedAsciiOutputStreamWriter
, only supports US-ASCII but also buffers like a java.io.BufferedOutputStream
. This can result in more efficient writes than using com.github.marschall.writers.AsciiOutputStreamWriter
with java.io.BufferedOutputStream
.byte[]
, the #write
and #append
methods do not allocate memoryThis project requires Java 11.