java.lang.Object
org.apache.beam.runners.spark.structuredstreaming.translation.helpers.CoderHelpers

public final class CoderHelpers extends Object
Serialization utility class.
  • Method Details

    • toByteArray

      public static <T> byte[] toByteArray(T value, Coder<T> coder)
      Utility method for serializing an object using the specified coder.
      Type Parameters:
      T - type of value that is serialized
      Parameters:
      value - Value to serialize.
      coder - Coder to serialize with.
      Returns:
      Byte array representing serialized object.
    • fromByteArray

      public static <T> T fromByteArray(byte[] serialized, Coder<T> coder)
      Utility method for deserializing a byte array using the specified coder.
      Type Parameters:
      T - Type of object to be returned.
      Parameters:
      serialized - bytearray to be deserialized.
      coder - Coder to deserialize with.
      Returns:
      Deserialized object.