JsonSinkProcessor<Reader extends JsonReader, Sink extends JsonSink> class
base
A generalized JSON processor which forwards data to a JSON sink.
Allows individual process
methods to be overridden for special
behavior, like detecting specific keys and treating values differently,
or detecting specific values and parsing them differently.
The default behavior of the process-methods is to call JsonSink.addKey
if the key
is non-null
, then expect a value and call the sink's
corresponding add
method with the value.
Example:
void processString(Reader reader, String? key) {
if (key != null) sink.addKey(key);
sink.addString(reader.expectString());
}
If overridden, the overriding method should make sure to call addKey
on the sink first when the key
is non-null, if it intends to add
any value (and not add the key if it intends to skip the value).
- Inheritance
-
- Object
- JsonProcessor<
Reader> - JsonSinkProcessor
Constructors
- JsonSinkProcessor(Sink sink)
- Creat a JSON processor forwarding events to sink.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- sink → Sink
-
The target sink.
final
Methods
-
endArray(
String? key) → void -
Called when an array has no more elements.
override
-
endObject(
String? key) → void -
Called after all key/value pairs of the current object are processed.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
processArray(
Reader reader, String? key) → bool -
Called when the reader encounters a JSON array.
override
-
processBool(
Reader reader, String? key) → void -
Called when the next value is a boolean value.
override
-
processNull(
Reader reader, String? key) → void -
Called when the next value is a
null
value.override -
processNum(
Reader reader, String? key) → void -
Called when the next value is a number value.
override
-
processObject(
Reader reader, String? key) → bool -
Called when the reader encounters the start of a JSON object.
override
-
processObjectEntry(
Reader reader) → void -
Called for each JSON object entry.
inherited
-
processString(
Reader reader, String? key) → void -
Called when the next value is a string value.
override
-
processUnknown(
Reader reader, String? key) → void -
Invoked for a reader which has no value or an unrecognized value.
inherited
-
processValue(
Reader reader, [String? key]) → void -
Process a JSON-value.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited