All Downloads are FREE. Search and download functionalities are using the official Maven repository.

serialize.Serializer.kt Maven / Gradle / Ivy

There is a newer version: 66.0.0
Show newest version
package ch.softappeal.yass.serialize

import java.io.ObjectInputStream
import java.io.ObjectOutputStream

interface Serializer {
    @Throws(Exception::class)
    fun read(reader: Reader): Any?

    @Throws(Exception::class)
    fun write(writer: Writer, value: Any?)
}

val JavaSerializer = object : Serializer {
    override fun read(reader: Reader) =
        ObjectInputStream(reader.stream()).use(ObjectInputStream::readObject)

    override fun write(writer: Writer, value: Any?) =
        ObjectOutputStream(writer.stream()).use { it.writeObject(value) }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy