code: public static byte[] toByteArray(Object obj, ClassLoader classLoader) {
          if (obj instanceof ISerializationSupport) {
              ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader();
              if (classLoader != null) {
                  Thread.currentThread().setContextClassLoader(classLoader);
              }
              try {
                  return ((ISerializationSupport) obj).toBytes();
              } finally {
                  Thread.currentThread().setContextClassLoader(oldClassLoader);
              }
          } else {
              return toByteArrayFst(obj, classLoader);
          }
      }
docs: Serialize an object to byte array, with a custom class loader.
  
  <p>
  If the target object implements {@link ISerializationSupport}, this
  method calls its {@link ISerializationSupport#toBytes()} method;
  otherwise FST library is used to serialize the object.
  </p>
  
  @param obj
  @param classLoader
  @return
  @deprecated since 0.9.2 with no replacement, use {@link #toByteArrayFst(Object, ClassLoader)}
  or {@link #toByteArrayKryo(Object, ClassLoader)}