WritingSerializer

A JVM-only Serializer that can also write directly to a Writer (e.g. a file or network stream), avoiding the need to first build the whole output as a String in memory. The String-returning serialize/serializeMany methods of Serializer are implemented in terms of the Writer-based ones, by writing into a StringWriter.

Type Parameters

T

the type of values this serializer can serialize.

Inheritors

Properties

Link copied to clipboard
abstract val mimeType: MimeType

The textual format this serializer produces.

Functions

Link copied to clipboard
open override fun serialize(value: T): String

Serializes a single value into its textual representation in mimeType.

abstract fun serialize(writer: Writer, value: T)

Serializes a single value, writing its textual representation to writer.

Link copied to clipboard
open fun serializeMany(values: Sequence<T>): String
open fun serializeMany(vararg values: T): String
open override fun serializeMany(values: Iterable<T>): String

Serializes several values into a single textual representation of all of them.

abstract fun serializeMany(writer: Writer, values: Iterable<T>)
open fun serializeMany(writer: Writer, values: Sequence<T>)
open fun serializeMany(writer: Writer, vararg values: T)

Serializes several values, writing their textual representation to writer.