Class ToonDecoder
java.lang.Object
io.micronaut.serde.toon.util.ToonDecoder
Builds a JSON tree from a TOON document.
Each call reads the stream and parses the text with a fresh ToonDocumentParser, which does the line pre-processing and
recursive-descent parsing.
- Since:
- 3.3.0
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionToonDecoder(SerdeToonConfiguration toonConfiguration) Creates a TOON decoder. -
Method Summary
Modifier and TypeMethodDescriptionio.micronaut.json.tree.JsonNodeparse(InputStream stream) Parses a TOON document from the given stream into a JSON tree, usingLimitingStream.DEFAULT_LIMITSas the nesting-depth budget.io.micronaut.json.tree.JsonNodeparse(InputStream stream, LimitingStream.RemainingLimits remainingLimits) Parses a TOON document from the given stream into a JSON tree, rejecting input nested deeper thanremainingLimitsallows.
-
Constructor Details
-
ToonDecoder
Creates a TOON decoder.- Parameters:
toonConfiguration- The TOON format configuration
-
-
Method Details
-
parse
Parses a TOON document from the given stream into a JSON tree, usingLimitingStream.DEFAULT_LIMITSas the nesting-depth budget.- Parameters:
stream- The TOON input stream- Returns:
- The parsed JSON tree
- Throws:
IOException- If the TOON input cannot be read or is malformed
-
parse
public io.micronaut.json.tree.JsonNode parse(InputStream stream, LimitingStream.RemainingLimits remainingLimits) throws IOException Parses a TOON document from the given stream into a JSON tree, rejecting input nested deeper thanremainingLimitsallows.- Parameters:
stream- The TOON input streamremainingLimits- The nesting-depth budget, e.g. fromLimitingStream.limitsFromConfiguration(SerdeConfiguration)- Returns:
- The parsed JSON tree
- Throws:
IOException- If the TOON input cannot be read, is malformed, or nests too deeply
-