Interface TokenWritable
- All Superinterfaces:
RecordWritable
- All Known Implementing Classes:
CborSerializer,CborSerializer.Base64,CborSerializer.SpacedHex,CborSerializerSession,JcsSerializer,JcsSerializerSession,Json5lSerializer,Json5lSerializerSession,Json5Serializer,Json5Serializer.Readable,Json5SerializerSession,JsonlSerializer,JsonlSerializerSession,JsonSchemaSerializer,JsonSchemaSerializer.Readable,JsonSchemaSerializerSession,JsonSerializer,JsonSerializer.Readable,JsonSerializerSession,MsgPackSerializer,MsgPackSerializer.Base64,MsgPackSerializer.SpacedHex,MsgPackSerializerSession
Capability role for serializers that additionally expose the structural
TokenWriter
cursor (FULL formats: json, json5, jsonl, cbor, msgpack, jsonschema, jcs).
Because TokenWriter IS-A RecordWriter, FULL formats get the record surface for
free — the writeRecords(Object) default returns
writeTokens(Object). Capability is detected via instanceof.
See Also:
TokenReadable— the symmetric reader role.- Serializers and Parsers
-
Method Summary
Modifier and TypeMethodDescriptiondefault RecordWriterwriteRecords(Object output) FULL formats get record semantics for free — aTokenWriterIS-ARecordWriter.writeTokens(Object output) Opens a low-levelTokenWriterpush generator targeting the specified output.Methods inherited from interface org.apache.juneau.marshall.stream.RecordWritable
isRecordStreaming
-
Method Details
-
writeTokens
Opens a low-levelTokenWriterpush generator targeting the specified output.- Parameters:
output- The output. Subtypes define the supported types: byte formats (cbor, msgpack) accept anOutputStream; char formats (json, json5, jsonl, jsonschema, jcs) accept aWriteror anOutputStream(encoded as UTF-8).- Returns:
- A new
TokenWriter. - Throws:
IOException- If a problem occurred opening the underlying output.
-
writeRecords
FULL formats get record semantics for free — aTokenWriterIS-ARecordWriter.- Specified by:
writeRecordsin interfaceRecordWritable- Parameters:
output- The output.- Returns:
- A new
RecordWritercursor (the same object aswriteTokens(Object)). - Throws:
IOException- If a problem occurred opening the underlying output.
-