code: public byte[] export(final StateFormat format) {
      try {
        if (format == StateFormat.JSON) {
          return JACKSON.writeValueAsBytes(this);
        } else {
          throw new IllegalStateException("Unsupported Format " + format);
        }
      } catch (Exception ex) {
        throw new RuntimeException("Could not encode SessionState to Format " + format, ex);
      }
    }
docs: Export the {@link PartitionState} into the desired format.
  
  @param format the format in which the state should be exposed, always uses the current version.
  @return the exported format, depending on the type can be converted into a string by the user.