public static boolean write(OutputStream stream,Object o) throws Exception {
  Class<?> komlClass;
  Class<?>[] komlClassArgs;
  Object[] komlArgs;
  java.lang.reflect.Constructor<?> constructor;
  Object koml;
  java.lang.reflect.Method methodAdd;
  java.lang.reflect.Method methodClose;
  Class<?>[] addArgsClasses;
  Class<?>[] closeArgsClasses;
  Object[] addArgs;
  Object[] closeArgs;
  boolean result;
  result=false;
  komlClass=Class.forName("fr.dyade.koala.xml.koml.KOMLSerializer");
  komlClassArgs=new Class[2];
  komlClassArgs[0]=java.io.OutputStream.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);
  addArgsClasses=new Class[1];
  addArgsClasses[0]=Object.class;
  methodAdd=komlClass.getMethod("addObject",addArgsClasses);
  addArgs=new Object[1];
  addArgs[0]=o;
  closeArgsClasses=new Class[0];
  methodClose=komlClass.getMethod("close",closeArgsClasses);
  closeArgs=new Object[0];
  try {
    methodAdd.invoke(koml,addArgs);
    result=true;
  }
 catch (  Exception e) {
    result=false;
  }
 finally {
    methodClose.invoke(koml,closeArgs);
  }
  return result;
}

public static boolean write ( OutputStream stream , Object o ) throws Exception { Class < ? > komlClass ; Class < ? > [ ] komlClassArgs ; Object [ ] komlArgs ; java . lang . reflect . Constructor < ? > constructor ; Object koml ; java . lang . reflect . Method methodAdd ; java . lang . reflect . Method methodClose ; Class < ? > [ ] addArgsClasses ; Class < ? > [ ] closeArgsClasses ; Object [ ] addArgs ; Object [ ] closeArgs ; boolean result ; result = false ; komlClass = Class . forName ( "fr.dyade.koala.xml.koml.KOMLSerializer" ) ; komlClassArgs = new Class [ 2 ] ; komlClassArgs [ 0 ] = java . io . OutputStream . 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 ) ; addArgsClasses = new Class [ 1 ] ; addArgsClasses [ 0 ] = Object . class ; methodAdd = komlClass . getMethod ( "addObject" , addArgsClasses ) ; addArgs = new Object [ 1 ] ; addArgs [ 0 ] = o ; closeArgsClasses = new Class [ 0 ] ; methodClose = komlClass . getMethod ( "close" , closeArgsClasses ) ; closeArgs = new Object [ 0 ] ; try { methodAdd . invoke ( koml , addArgs ) ; result = true ; } catch ( Exception e ) { result = false ; } finally { methodClose . invoke ( koml , closeArgs ) ; } return result ; }
writes the xml - serialized object to a stream
