encodeToStream

fun <T> Json5.encodeToStream(serializer: SerializationStrategy<T>, value: T, outputStream: OutputStream)(source)

Serializes the given value using the given serializer and writes the result to outputStream.

Data written to outputStream will have UTF-8 encoding. It is not closed upon completion of this operation.

If human-readable output is requested, the function will use UNIX-style line endings. A final newline character is not generated.

Parameters

serializer

SerializationStrategy to use for the serialization.

value

The object hierarchy to serialize.

outputStream

OutputStream to write the UTF-8 result to.

Throws

An error occurred while writing to outputStream.


inline fun <T> Json5.encodeToStream(value: T, outputStream: OutputStream)(source)

Convenience function that calls Json5.encodeToStream with the default serializer for the type.