Class LazilyAllocatingHeapWriteOutBytes

java.lang.Object
java.io.OutputStream
org.apache.druid.segment.writeout.WriteOutBytes
org.apache.druid.segment.writeout.LazilyAllocatingHeapWriteOutBytes
All Implemented Interfaces:
Closeable, Flushable, AutoCloseable, Channel, WritableByteChannel

public class LazilyAllocatingHeapWriteOutBytes extends WriteOutBytes
Lazily decides to use a tmpBuffer to act as WriteOutBytes, till more than certain threshold is reached. Once this is met, it switches to delegating all calls to a WriteOutBytes created by delegateSupplier.

This is useful if the data stored in the WriteOutBytes is small enough that buffering the changes in memory would be faster than creating some WriteOutBytes.