@Override public void writeObject(Object obj,AbstractHessianOutput out) throws IOException {
  if (out.addRef(obj)) {
    return;
  }
  int ref=out.writeObjectBegin(getClassName(obj));
  if (ref < -1) {
    out.writeString("value");
    InputStream is=null;
    try {
      is=getInputStream(obj);
    }
 catch (    Exception e) {
      log.log(Level.WARNING,e.toString(),e);
    }
    if (is != null) {
      try {
        out.writeByteStream(is);
      }
  finally {
        is.close();
      }
    }
 else {
      out.writeNull();
    }
    out.writeMapEnd();
  }
 else {
    if (ref == -1) {
      out.writeClassFieldLength(1);
      out.writeString("value");
      out.writeObjectBegin(getClassName(obj));
    }
    InputStream is=null;
    try {
      is=getInputStream(obj);
    }
 catch (    Exception e) {
      log.log(Level.WARNING,e.toString(),e);
    }
    try {
      if (is != null)       out.writeByteStream(is);
 else       out.writeNull();
    }
  finally {
      if (is != null)       is.close();
    }
  }
}

@ Override public void writeObject ( Object obj , AbstractHessianOutput out ) throws IOException { if ( out . addRef ( obj ) ) { return ; } int ref = out . writeObjectBegin ( getClassName ( obj ) ) ; if ( ref < - 1 ) { out . writeString ( "value" ) ; InputStream is = null ; try { is = getInputStream ( obj ) ; } catch ( Exception e ) { log . log ( Level . WARNING , e . toString ( ) , e ) ; } if ( is != null ) { try { out . writeByteStream ( is ) ; } finally { is . close ( ) ; } } else { out . writeNull ( ) ; } out . writeMapEnd ( ) ; } else { if ( ref == - 1 ) { out . writeClassFieldLength ( 1 ) ; out . writeString ( "value" ) ; out . writeObjectBegin ( getClassName ( obj ) ) ; } InputStream is = null ; try { is = getInputStream ( obj ) ; } catch ( Exception e ) { log . log ( Level . WARNING , e . toString ( ) , e ) ; } try { if ( is != null ) out . writeByteStream ( is ) ; else out . writeNull ( ) ; } finally { if ( is != null ) is . close ( ) ; } } }
writes the object to the output stream .
