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 and Description |
---|
BufferingJSONAsyncParser(JSONContext<? extends Message.Mutable> jsonContext) |
Modifier and Type | Method and Description |
---|---|
<R> R |
complete()
Signals the end of the JSON string content to this parser and returns the parsed object.
|
void |
parse(byte[] bytes,
int offset,
int length) |
void |
parse(ByteBuffer byteBuffer) |
public BufferingJSONAsyncParser(JSONContext<? extends Message.Mutable> jsonContext)
public void parse(byte[] bytes, int offset, int length)
parse
in interface JSONContext.AsyncParser
bytes
- the bytes chunk to parseoffset
- the offset to start parsing fromlength
- the number of bytes to parsepublic void parse(ByteBuffer byteBuffer)
parse
in interface JSONContext.AsyncParser
byteBuffer
- the buffer chunk to parsepublic <R> R complete()
JSONContext.AsyncParser
Signals the end of the JSON string content to this parser and returns the parsed object.
complete
in interface JSONContext.AsyncParser
R
- the type to cast the result toCopyright © 2008–2024 The CometD Project. All rights reserved.