encodeCollection

inline fun Encoder.encodeCollection(    descriptor: SerialDescriptor,     collectionSize: Int,     crossinline block: CompositeEncoder.() -> Unit)

Begins a collection, encodes it using the given block and ends it.


inline fun <E> Encoder.encodeCollection(    descriptor: SerialDescriptor,     collection: Collection<E>,     crossinline block: CompositeEncoder.(index: Int, E) -> Unit)

Begins a collection, calls block with each item and ends the collections.