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

com.avsystem.commons.kafka.VersionedSerializer.scala Maven / Gradle / Ivy

The newest version!
package com.avsystem.commons
package kafka

import java.io.ByteArrayOutputStream

import com.avsystem.commons.serialization.GenCodec

class VersionedSerializer[T](version: Byte)(implicit codec: GenCodec[T]) extends AbstractSerializer[T] {

  private val serde = new CodecSerde(codec)

  override def serialize(topic: String, data: T): Array[Byte] = {
    val output = new ByteArrayOutputStream()
    output.write(version)
    serde.serialize(output, data)
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy