Interface TokenReadable
- All Superinterfaces:
RecordReadable
- All Known Implementing Classes:
CborParser,CborParser.Base64,CborParser.SpacedHex,CborParserSession,Json5lParser,Json5lParserSession,Json5Parser,Json5ParserSession,JsonlParser,JsonlParserSession,JsonParser,JsonParserSession,MsgPackParser,MsgPackParser.Base64,MsgPackParser.SpacedHex,MsgPackParserSession
Capability role for parsers that additionally expose the structural
TokenReader cursor
(FULL formats: json, json5, jsonl, cbor, msgpack).
Because TokenReader IS-A RecordReader, FULL formats get the record surface for
free — the readRecords(Object) default returns readTokens(Object).
Capability is detected via instanceof; a format that supports tokens is a
TokenReadable (and transitively a RecordReadable).
See Also:
TokenWritable— the symmetric writer role.- Serializers and Parsers
-
Method Summary
Modifier and TypeMethodDescriptiondefault RecordReaderreadRecords(Object input) FULL formats get record semantics for free — aTokenReaderIS-ARecordReader.readTokens(Object input) Opens a low-levelTokenReadercursor over the specified input.Methods inherited from interface org.apache.juneau.marshall.stream.RecordReadable
isRecordStreaming
-
Method Details
-
readTokens
Opens a low-levelTokenReadercursor over the specified input.- Parameters:
input- The input. Subtypes define the supported types (typicallyReader/CharSequence/InputStream/).byte []- Returns:
- A new
TokenReadercursor positioned atTokenType.NOT_AVAILABLE. - Throws:
IOException- If a problem occurred reading the underlying input.
-
readRecords
FULL formats get record semantics for free — aTokenReaderIS-ARecordReader.- Specified by:
readRecordsin interfaceRecordReadable- Parameters:
input- The input.- Returns:
- A new
RecordReadercursor (the same object asreadTokens(Object)). - Throws:
IOException- If a problem occurred reading the underlying input.
-