public static <T> String serialize(String name, T object) {
    try (ByteArrayOutputStream baos = new ByteArrayOutputStream();
        ObjectOutputStream oos = new ObjectOutputStream(baos)) {
      oos.writeObject(object);
      return Base64.getEncoder().encodeToString(baos.toByteArray());
    } catch (IOException e) {
      throw new SamzaException("Failed to serialize " + name, e);
    }
  }
Helper method to serialize Java objects as Base64 strings
@param name name of the object (for error reporting)
@param object object to be serialized
@return Base64 representation of the object
@param <T> type of the object
samza-api/src/main/java/org/apache/samza/table/utils/SerdeUtils.java