Object invokeWriteReplace(Object obj) throws IOException, UnsupportedOperationException {
  requireInitialized();
  if (writeReplaceMethod != null) {
    try {
      return writeReplaceMethod.invoke(obj,(Object[])null);
    }
 catch (    InvocationTargetException ex) {
      Throwable th=ex.getTargetException();
      if (th instanceof ObjectStreamException) {
        throw (ObjectStreamException)th;
      }
 else {
        throwMiscException(th);
        throw new InternalError(th);
      }
    }
catch (    IllegalAccessException ex) {
      throw new InternalError(ex);
    }
  }
 else {
    throw new UnsupportedOperationException();
  }
}

Object invokeWriteReplace ( Object obj ) throws IOException , UnsupportedOperationException { requireInitialized ( ) ; if ( writeReplaceMethod != null ) { try { return writeReplaceMethod . invoke ( obj , ( Object [ ] ) null ) ; } catch ( InvocationTargetException ex ) { Throwable th = ex . getTargetException ( ) ; if ( th instanceof ObjectStreamException ) { throw ( ObjectStreamException ) th ; } else { throwMiscException ( th ) ; throw new InternalError ( th ) ; } } catch ( IllegalAccessException ex ) { throw new InternalError ( ex ) ; } } else { throw new UnsupportedOperationException ( ) ; } }
invokes the writereplace method of the represented serializable class and returns the result . throws unsupportedoperationexception if this class descriptor is not associated with a class , or if the class is non - serializable or does not define writereplace .
