public ObjectInputStream deserialize(String className,ObjectName loaderName,byte[] data,ClassLoader loader) throws InstanceNotFoundException, OperationsException, ReflectionException {
  if (data == null) {
    throw new RuntimeOperationsException(new IllegalArgumentException(),"Null data passed in parameter");
  }
  if (data.length == 0) {
    throw new RuntimeOperationsException(new IllegalArgumentException(),"Empty data passed in parameter");
  }
  if (className == null) {
    throw new RuntimeOperationsException(new IllegalArgumentException(),"Null className passed in parameter");
  }
  ReflectUtil.checkPackageAccess(className);
  Class<?> theClass;
  if (loaderName == null) {
    theClass=findClass(className,loader);
  }
 else {
    try {
      ClassLoader instance=null;
      instance=getClassLoader(loaderName);
      if (instance == null)       throw new ClassNotFoundException(className);
      theClass=Class.forName(className,false,instance);
    }
 catch (    ClassNotFoundException e) {
      throw new ReflectionException(e,"The MBean class could not be loaded by the " + loaderName.toString() + " class loader");
    }
  }
  ByteArrayInputStream bIn;
  ObjectInputStream objIn;
  bIn=new ByteArrayInputStream(data);
  try {
    objIn=new ObjectInputStreamWithLoader(bIn,theClass.getClassLoader());
  }
 catch (  IOException e) {
    throw new OperationsException("An IOException occurred trying to de-serialize the data");
  }
  return objIn;
}

public ObjectInputStream deserialize ( String className , ObjectName loaderName , byte [ ] data , ClassLoader loader ) throws InstanceNotFoundException , OperationsException , ReflectionException { if ( data == null ) { throw new RuntimeOperationsException ( new IllegalArgumentException ( ) , "Null data passed in parameter" ) ; } if ( data . length == 0 ) { throw new RuntimeOperationsException ( new IllegalArgumentException ( ) , "Empty data passed in parameter" ) ; } if ( className == null ) { throw new RuntimeOperationsException ( new IllegalArgumentException ( ) , "Null className passed in parameter" ) ; } ReflectUtil . checkPackageAccess ( className ) ; Class < ? > theClass ; if ( loaderName == null ) { theClass = findClass ( className , loader ) ; } else { try { ClassLoader instance = null ; instance = getClassLoader ( loaderName ) ; if ( instance == null ) throw new ClassNotFoundException ( className ) ; theClass = Class . forName ( className , false , instance ) ; } catch ( ClassNotFoundException e ) { throw new ReflectionException ( e , "The MBean class could not be loaded by the " + loaderName . toString ( ) + " class loader" ) ; } } ByteArrayInputStream bIn ; ObjectInputStream objIn ; bIn = new ByteArrayInputStream ( data ) ; try { objIn = new ObjectInputStreamWithLoader ( bIn , theClass . getClassLoader ( ) ) ; } catch ( IOException e ) { throw new OperationsException ( "An IOException occurred trying to de-serialize the data" ) ; } return objIn ; }
de - serializes a byte array in the context of a given mbean class loader . < p > the class loader is the one that loaded the class with name " classname " . < p > the name of the class loader to be used for loading the specified class is specified . if null , a default one has to be provided ( for a mbean server , its own class loader will be used ) .
