Class BufferingJSONAsyncParser
java.lang.Object
org.cometd.common.BufferingJSONAsyncParser
- All Implemented Interfaces:
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 Summary
ConstructorDescriptionBufferingJSONAsyncParser
(JSONContext<? extends Message.Mutable> jsonContext) -
Method Summary
Modifier and TypeMethodDescription<R> R
complete()
Signals the end of the JSON string content to this parser and returns the parsed object.void
parse
(ByteBuffer byteBuffer)
-
Constructor Details
-
BufferingJSONAsyncParser
-
-
Method Details
-
parse
- Specified by:
parse
in interfaceJSONContext.AsyncParser
- Parameters:
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 interfaceJSONContext.AsyncParser
- Type Parameters:
R
- the type to cast the result to- Returns:
- the result of the JSON parsing
-