Class Json5lTokenReader
java.lang.Object
org.apache.juneau.marshall.json.JsonTokenReader
org.apache.juneau.marshall.json5.Json5TokenReader
org.apache.juneau.marshall.json5l.Json5lTokenReader
- All Implemented Interfaces:
Closeable,AutoCloseable,RecordReader,TokenReader
Reference implementation of the public
TokenReader surface for the JSON5L format.
Subclasses Json5TokenReader to inherit the JSON5 dialect relaxations (single-quoted and
bare-identifier strings/field names, trailing commas, missing values, comments) and adds JSONL's
flat top-level sequencing: each line's value is emitted in turn at depth 0
and JsonTokenReader.next() returns TokenType.END_OF_STREAM only when the input is exhausted.
Notes:
- This class is not thread safe.
- The cursor is a true O(1)-memory streaming cursor (
TokenReader.isStreaming()==true ).
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.juneau.marshall.json.JsonTokenReader
JsonTokenReader.Settings -
Field Summary
Fields inherited from class org.apache.juneau.marshall.json.JsonTokenReader
currentBoolean, currentFieldName, currentNumberLexeme, currentString, currentToken, depth, r, S00_expectValue, S01_expectFieldName, S02_expectColon, S03_expectCommaOrEndObject, S04_expectCommaOrEndArray, S05_end, settings, stateFields inherited from interface org.apache.juneau.marshall.stream.TokenReader
MSG_READ_NON_VALUE_STATE -
Constructor Summary
ConstructorsConstructorDescriptionJson5lTokenReader(ParserPipe pipe) Constructor with default settings.Json5lTokenReader(ParserPipe pipe, JsonTokenReader.Settings settings, Json5lParserSession session) Constructor used byJson5lParserSession.readTokens(Object)to plumb the calling session through so thatJsonTokenReader.read(Class)can delegate to the JSON5L databind path. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidSets the post-value state based on the enclosing container.Methods inherited from class org.apache.juneau.marshall.json5.Json5TokenReader
allowsTrailingComma, getNumber, readCommaOrEndArray, readCommaOrEndObject, readFieldNameOrEndObject, readNumberValue, readString, readValueStartMethods inherited from class org.apache.juneau.marshall.json.JsonTokenReader
canRead, close, getBinary, getBool, getCurrentToken, getDepth, getFieldName, getNumberLexeme, getString, isDigit, isInArray, isNumberStart, next, parseException, popContainer, pushContainer, read, read, read, readKeywordValue, readSkipWsAndComments, skipChildrenMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.juneau.marshall.stream.RecordReader
iterator, streamMethods inherited from interface org.apache.juneau.marshall.stream.TokenReader
getExtType, getNativeKind, getSimpleValue, getTag, getTagCount, isStreaming
-
Constructor Details
-
Json5lTokenReader
Constructor with default settings.- Parameters:
pipe- The parser input pipe to read from. Must not benull .- Throws:
IOException- If a problem occurred opening the underlying reader.
-
Json5lTokenReader
public Json5lTokenReader(ParserPipe pipe, JsonTokenReader.Settings settings, Json5lParserSession session) throws IOException Constructor used byJson5lParserSession.readTokens(Object)to plumb the calling session through so thatJsonTokenReader.read(Class)can delegate to the JSON5L databind path.- Parameters:
pipe- The parser input pipe. Must not benull .settings- The cursor-level settings. Must not benull .session- TheJson5lParserSessionforJsonTokenReader.read(Class)delegation, ornull to disableread.- Throws:
IOException- If a problem occurred opening the underlying reader.
-
-
Method Details
-
afterValue
Description copied from class:JsonTokenReaderSets the post-value state based on the enclosing container.Subclasses (e.g. JsonlTokenReader) override this when the format treats consecutive top-level values differently — JSONL transitions back to
JsonTokenReader.S00_expectValueat depth 0 instead ofJsonTokenReader.S05_endso the next line is read.- Overrides:
afterValuein classJsonTokenReader
-