write

abstract fun write(): Metadata

Encodes and writes this metadata to the new instance of Metadata.

This method encodes all available data, including version and flags. Due to technical limitations, it is not possible to write the metadata when the specified version is less than 1.4. It is also not possible to write metadata with the version higher that JvmMetadataVersion.LATEST_STABLE_SUPPORTED + 1, as we do not know if a metadata format is the same for yet unreleased Kotlin compilers.

Throws

if metadata is malformed, or metadata was read in lenient mode and cannot be written back, or version of this instance is less than 1.4, or version of this instance is too high.