Class PooledSpecializedStringWriter

java.lang.Object
java.io.Writer
io.pebbletemplates.pebble.extension.writer.PooledSpecializedStringWriter
All Implemented Interfaces:
SpecializedWriter, Closeable, Flushable, Appendable, AutoCloseable

public class PooledSpecializedStringWriter extends Writer implements SpecializedWriter
A $SpecializedWriter that's pooled in a $ThreadLocal. It's backed by a $StringBuilder so it's not threadsafe but doesn't involve synchronization. Beware that it has some limitations:
  • As it's backed by a $ThreadLocal, it might leak in environments where ClassLoaders are rebooted at runtime
  • It doesn't take any security measure against very large payloads that would cause underlying buffers to eat memory