writeData

abstract fun <P : Any, C : Any> writeData(type: PersistentDataType<P, C>, data: C)(source)

Writes data of a specific type to the output stream using the provided PersistentDataType.

The method uses the specified PersistentDataType to convert the complex data type into its corresponding primitive data type, which is then written to the output stream.

Parameters

type

the PersistentDataType used to define the conversion between primitive and complex data types, as well as specifying the expected output data type

data

the complex data type to be converted and written to the stream

Throws

if an I/O error occurs during the write process