Interface ServerSentEventParser.Incremental

Enclosing interface:
ServerSentEventParser

public static interface ServerSentEventParser.Incremental
Stateful, non-blocking SSE parser. Bytes are pushed in via feed(ByteBuffer) as they arrive on the wire; complete events are returned synchronously. Any partial trailing line/event is buffered internally and joined with subsequent feeds.

Each call to ServerSentEventParser.incremental() returns a fresh instance — do not share between concurrent streams.

  • Method Summary

    Modifier and Type
    Method
    Description
    Feeds a chunk of bytes; returns any events that became complete with this chunk.
    Called when the upstream stream completes normally.
  • Method Details

    • feed

      Feeds a chunk of bytes; returns any events that became complete with this chunk. Bytes belonging to an incomplete trailing line/event are retained internally for the next call. Implementations must handle UTF-8 multi-byte sequences split across chunks.
    • flush

      Called when the upstream stream completes normally. Returns any final event still buffered (e.g. an event whose terminating blank line was never received because the stream ended). Subsequent calls to feed(ByteBuffer) after flush() are undefined.