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

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

    Modifier and Type
    Method
    Description
    static <T> T
    fromByteArray(byte[] serialized, org.apache.beam.sdk.coders.Coder<T> coder)
    Utility method for deserializing a byte array using the specified coder.
    static <T> byte[]
    toByteArray(T value, org.apache.beam.sdk.coders.Coder<T> coder)
    Utility method for serializing an object using the specified coder.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • toByteArray

      public static <T> byte[] toByteArray(T value, org.apache.beam.sdk.coders.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, org.apache.beam.sdk.coders.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.