Class BufferingJSONAsyncParser

All Implemented Interfaces:

public class BufferingJSONAsyncParser extends Object implements JSONContext.AsyncParser

A JSONContext.AsyncParser that parses an array of Bayeux messages.

This is not a generic parser that can parse any JSON.

This parser buffers all input bytes in memory, and performs blocking JSON parsing via JSONContext.parse(String) only when complete() is called.

  • Constructor Details

  • Method Details

    • parse

      public void parse(byte[] bytes, int offset, int length)
      Specified by:
      parse in interface JSONContext.AsyncParser
      bytes - the bytes chunk to parse
      offset - the offset to start parsing from
      length - the number of bytes to parse
    • parse

      public void parse(ByteBuffer byteBuffer)
      Specified by:
      parse in interface JSONContext.AsyncParser
      byteBuffer - the buffer chunk to parse
    • complete

      public <R> R complete()
      Description copied from interface: JSONContext.AsyncParser

      Signals the end of the JSON string content to this parser and returns the parsed object.

      Specified by:
      complete in interface JSONContext.AsyncParser
      Type Parameters:
      R - the type to cast the result to
      the result of the JSON parsing