kernl.data.source.serialize.DoubleSerializer.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of Kernl.Runtime Show documentation
Show all versions of Kernl.Runtime Show documentation
Kernl: A Kotlin Symbol Processing (KSP) library for automatic repository generation.
package io.github.mattshoe.shoebox.kernl.data.source.serialize
import java.nio.ByteBuffer
class DoubleSerializer: Serializer {
override fun serialize(data: Double): ByteArray {
return ByteBuffer.allocate(Double.SIZE_BYTES).putDouble(data).array()
}
override fun deserialize(data: ByteArray): Double {
return ByteBuffer.wrap(data).getDouble()
}
}