public void writeObject ( Object obj , AbstractHessianOutput out ) throws IOException { if ( out . addRef ( obj ) ) { return ; } Class < ? > cl = obj . getClass ( ) ; try { if ( writeReplace != null ) { Object repl = writeReplace . invoke ( obj , new Object [ 0 ] ) ; out . removeRef ( obj ) ; out . writeObject ( repl ) ; out . replaceRef ( repl , obj ) ; return ; } } catch ( Exception e ) { log . log ( Level . FINE , e . toString ( ) , e ) ; } int ref = out . writeObjectBegin ( cl . getName ( ) ) ; if ( ref < - 1 ) { // Hessian 1.1 uses a map for ( int i = 0 ; i < localMethods . length ; i ++ ) { Object value = null ; try { value = localMethods [ i ] . invoke ( obj , ( Object [ ] ) null ) ; } catch ( Exception e ) { log . log ( Level . FINE , e . toString ( ) , e ) ; } if ( ! LazyUtil . isPropertyInitialized ( value ) ) { continue ; } out . writeString ( localNames [ i ] ) ; out . writeObject ( value ) ; } out . writeMapEnd ( ) ; } else { if ( ref == - 1 ) { out . writeInt ( localNames . length ) ; for ( int i = 0 ; i < localNames . length ; i ++ ) { out . writeString ( localNames [ i ] ) ; } out . writeObjectBegin ( cl . getName ( ) ) ; } for ( int i = 0 ; i < localMethods . length ; i ++ ) { Object value = null ; try { value = localMethods [ i ] . invoke ( obj , ( Object [ ] ) null ) ; } catch ( Exception e ) { log . log ( Level . FINER , e . toString ( ) , e ) ; } if ( ! LazyUtil . isPropertyInitialized ( value ) ) { continue ; } out . writeObject ( value ) ; } } }
Write object in output