public static Object read(InputStream stream) throws Exception {
  Class<?> komlClass;
  Class<?>[] komlClassArgs;
  Object[] komlArgs;
  java.lang.reflect.Constructor<?> constructor;
  Object koml;
  java.lang.reflect.Method methodRead;
  java.lang.reflect.Method methodClose;
  Class<?>[] readArgsClasses;
  Class<?>[] closeArgsClasses;
  Object[] readArgs;
  Object[] closeArgs;
  Object result;
  result=null;
  komlClass=Class.forName("fr.dyade.koala.xml.koml.KOMLDeserializer");
  komlClassArgs=new Class[2];
  komlClassArgs[0]=java.io.InputStream.class;
  komlClassArgs[1]=Boolean.TYPE;
  komlArgs=new Object[2];
  komlArgs[0]=stream;
  komlArgs[1]=new Boolean(false);
  constructor=komlClass.getConstructor(komlClassArgs);
  koml=constructor.newInstance(komlArgs);
  readArgsClasses=new Class[0];
  methodRead=komlClass.getMethod("readObject",readArgsClasses);
  readArgs=new Object[0];
  closeArgsClasses=new Class[0];
  methodClose=komlClass.getMethod("close",closeArgsClasses);
  closeArgs=new Object[0];
  try {
    result=methodRead.invoke(koml,readArgs);
  }
 catch (  Exception e) {
    result=null;
  }
 finally {
    methodClose.invoke(koml,closeArgs);
  }
  return result;
}

public static Object read ( InputStream stream ) throws Exception { Class < ? > komlClass ; Class < ? > [ ] komlClassArgs ; Object [ ] komlArgs ; java . lang . reflect . Constructor < ? > constructor ; Object koml ; java . lang . reflect . Method methodRead ; java . lang . reflect . Method methodClose ; Class < ? > [ ] readArgsClasses ; Class < ? > [ ] closeArgsClasses ; Object [ ] readArgs ; Object [ ] closeArgs ; Object result ; result = null ; komlClass = Class . forName ( "fr.dyade.koala.xml.koml.KOMLDeserializer" ) ; komlClassArgs = new Class [ 2 ] ; komlClassArgs [ 0 ] = java . io . InputStream . class ; komlClassArgs [ 1 ] = Boolean . TYPE ; komlArgs = new Object [ 2 ] ; komlArgs [ 0 ] = stream ; komlArgs [ 1 ] = new Boolean ( false ) ; constructor = komlClass . getConstructor ( komlClassArgs ) ; koml = constructor . newInstance ( komlArgs ) ; readArgsClasses = new Class [ 0 ] ; methodRead = komlClass . getMethod ( "readObject" , readArgsClasses ) ; readArgs = new Object [ 0 ] ; closeArgsClasses = new Class [ 0 ] ; methodClose = komlClass . getMethod ( "close" , closeArgsClasses ) ; closeArgs = new Object [ 0 ] ; try { result = methodRead . invoke ( koml , readArgs ) ; } catch ( Exception e ) { result = null ; } finally { methodClose . invoke ( koml , closeArgs ) ; } return result ; }
reads the xml - serialized object from a stream
