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

kernl.data.source.serialize.ShortSerializer.kt Maven / Gradle / Ivy

Go to download

Kernl: A Kotlin Symbol Processing (KSP) library for automatic repository generation.

There is a newer version: 0.0.1-beta6
Show newest version
package io.github.mattshoe.shoebox.kernl.data.source.serialize

import java.nio.ByteBuffer

class ShortSerializer: Serializer {
    override fun serialize(data: Short): ByteArray {
        return ByteBuffer.allocate(Short.SIZE_BYTES).putShort(data).array()
    }

    override fun deserialize(data: ByteArray): Short {
        return ByteBuffer.wrap(data).getShort()
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy