Class SequenceWriter

  • All Implemented Interfaces:
    Versioned, Closeable, Flushable, AutoCloseable

    public class SequenceWriter
    extends Object
    implements Versioned, Closeable, Flushable
    Writer class similar to ObjectWriter, except that it can be used for writing sequences of values, not just a single value. The main use case is in writing very long sequences, or sequences where values are incrementally produced; cases where it would be impractical or at least inconvenient to construct a wrapper container around values (or where no JSON array is desired around values).

    Differences from ObjectWriter include:

    • Instances of SequenceWriter are stateful, and not thread-safe: if sharing, external synchronization must be used.
    • Explicit close() is needed after all values have been written (ObjectWriter can auto-close after individual value writes)
    Since:
    2.5