cdrinputstream_1_0.java
来自「java jdk 1.4的源码」· Java 代码 · 共 2,002 行 · 第 1/5 页
JAVA
2,002 行
// We failed... throw new MARSHAL(com.sun.corba.se.internal.orbutil.MinorCodes.READ_OBJECT_EXCEPTION, CompletionStatus.COMPLETED_NO); } protected static ObjectImpl newStub(Class stubClass,Delegate delegate) throws InstantiationException, IllegalAccessException, NoSuchMethodException, InvocationTargetException { // What kind of stub do we have? if (java.rmi.Remote.class.isAssignableFrom(stubClass)) { // RMI. Instantiate, set delegate and return... ObjectImpl objref = (ObjectImpl) stubClass.newInstance(); objref._set_delegate(delegate); return objref; } // RMI Abstract OR IDL. Instantiate, set delegate and return... try { // Try creating the stub using the default constructor... ObjectImpl result = (ObjectImpl)stubClass.newInstance(); result._set_delegate(delegate); return result; } catch (Throwable e) { if (e instanceof ThreadDeath) { throw (ThreadDeath) e; } } // Try creating the stub using the delegate constructor... Class[] intArgsClass = new Class[] {org.omg.CORBA.portable.Delegate.class}; java.lang.Object[]intArgs = new java.lang.Object[] {delegate}; java.lang.reflect.Constructor intArgsConstructor; intArgsConstructor = stubClass.getConstructor(intArgsClass); return (ObjectImpl)intArgsConstructor.newInstance(intArgs); } public java.lang.Object read_abstract_interface() { return read_abstract_interface(null); } public java.lang.Object read_abstract_interface(java.lang.Class clz) { boolean object = read_boolean(); if (object) { return read_Object(clz); } else { return read_value(); } } public Serializable read_value() { // Read value tag int vType = readValueTag(); if (vType == 0) return null; // value is null else if (vType == 0xffffffff) { // Indirection tag int indirection = read_long() + get_offset() - 4; if (valueCache != null && valueCache.containsVal(indirection)) { java.io.Serializable cachedValue = (java.io.Serializable)valueCache.getKey(indirection); return cachedValue; } else { throw new IndirectionException(indirection); } } else { int indirection = get_offset() - 4; // end_block(); boolean saveIsChunked = isChunked; isChunked = repIdUtil.isChunkedEncoding(vType); java.lang.Object value = null; String codebase_URL = null; if (repIdUtil.isCodeBasePresent(vType)){ codebase_URL = read_codebase_URL(); } // Read repository id String repositoryIDString = null; switch(repIdUtil.getTypeInfo(vType)){ case RepositoryIdUtility.NO_TYPE_INFO : throw new MARSHAL("read_value() with no repository ID info", MinorCodes.READ_VALUE_AND_NO_REP_ID, CompletionStatus.COMPLETED_MAYBE); case RepositoryIdUtility.SINGLE_REP_TYPE_INFO : repositoryIDString = read_repositoryId(); break; case RepositoryIdUtility.PARTIAL_LIST_TYPE_INFO : repositoryIDString = read_repositoryIds(); break; } // indirection = get_offset(); start_block(); end_flag--; if (isChunked) chunkedValueNestingLevel--; if (repositoryIDString.equals(repIdStrs.getWStringValueRepId())) { value = read_wstring(); } else if (repositoryIDString.equals(repIdStrs.getClassDescValueRepId())) { // read the class either with the wrong RepId or the // correct RepId for the classDesc value = readClass(); } else { Class valueClass = getClassFromString(repositoryIDString, codebase_URL); if ((valueClass != null) && org.omg.CORBA.portable.IDLEntity.class.isAssignableFrom(valueClass)) { value = readIDLValue(indirection, repositoryIDString, valueClass, codebase_URL); } else { try { // cannot cache this since this value will be different if (valueHandler == null) { valueHandler = ORBUtility.createValueHandler(orb); } value = valueHandler.readValue(parent, indirection, valueClass, repositoryIDString, getCodeBase()); } catch(Exception ex) { debugPrintThrowable(ex); throw new org.omg.CORBA.MARSHAL("Unable to read value from underlying bridge : " + ex.getMessage(), MinorCodes.VALUEHANDLER_READ_EXCEPTION, CompletionStatus.COMPLETED_MAYBE); } catch(Error e) { debugPrintThrowable(e); throw new org.omg.CORBA.MARSHAL("Unable to read value from underlying bridge : " + e.getMessage(), MinorCodes.VALUEHANDLER_READ_ERROR, CompletionStatus.COMPLETED_MAYBE); } } } handleEndOfValue(); readEndTag(); // Put into valueCache if (valueCache == null) valueCache = new CacheTable(false); valueCache.put(value, indirection); // allow for possible continuation chunk isChunked = saveIsChunked; start_block(); return (java.io.Serializable)value; } } public Serializable read_value(Class expectedType) { // Read value tag int vType = readValueTag(); if (vType == 0) return null; // value is null else if (vType == 0xffffffff) { // Indirection tag int indirection = read_long() + get_offset() - 4; if (valueCache != null && valueCache.containsVal(indirection)) { java.io.Serializable cachedValue = (java.io.Serializable)valueCache.getKey(indirection); return cachedValue; } else { throw new IndirectionException(indirection); } } else { int indirection = get_offset() - 4; // end_block(); boolean saveIsChunked = isChunked; isChunked = repIdUtil.isChunkedEncoding(vType); java.lang.Object value = null; String codebase_URL = null; if (repIdUtil.isCodeBasePresent(vType)){ codebase_URL = read_codebase_URL(); } // Read repository id String repositoryIDString = null; switch(repIdUtil.getTypeInfo(vType)){ case RepositoryIdUtility.NO_TYPE_INFO : // Throw an exception if we have no repository ID info and // no expectedType to work with. Otherwise, how would we // know what to unmarshal? if (expectedType == null) throw new MARSHAL("Expected type null and no repository ID info", MinorCodes.EXPECTED_TYPE_NULL_AND_NO_REP_ID, CompletionStatus.COMPLETED_MAYBE); repositoryIDString = repIdStrs.createForAnyType(expectedType); break; case RepositoryIdUtility.SINGLE_REP_TYPE_INFO : repositoryIDString = read_repositoryId(); break; case RepositoryIdUtility.PARTIAL_LIST_TYPE_INFO : repositoryIDString = read_repositoryIds(); break; } // indirection = get_offset(); start_block(); end_flag--; if (isChunked) chunkedValueNestingLevel--; if (repositoryIDString.equals(repIdStrs.getWStringValueRepId())) { value = read_wstring(); } else if (repositoryIDString.equals(repIdStrs.getClassDescValueRepId())) { // read in the class whether with the old ClassDesc or the // new one value = readClass(); } else { Class valueClass = expectedType; // By this point, either the expectedType or repositoryIDString // is guaranteed to be non-null. if (expectedType == null || !repositoryIDString.equals(repIdStrs.createForAnyType(expectedType))) { valueClass = getClassFromString(repositoryIDString, codebase_URL, expectedType); } if ((valueClass != null) && org.omg.CORBA.portable.IDLEntity.class.isAssignableFrom(valueClass)) { value = readIDLValue(indirection, repositoryIDString, valueClass, codebase_URL); } else { try { if (valueHandler == null) { valueHandler = ORBUtility.createValueHandler(orb); } value = valueHandler.readValue(parent, indirection, valueClass, repositoryIDString, getCodeBase()); } catch(Exception ex) { debugPrintThrowable(ex); throw new org.omg.CORBA.MARSHAL("Unable to read value from underlying bridge : " + ex.getMessage(), MinorCodes.VALUEHANDLER_READ_EXCEPTION, CompletionStatus.COMPLETED_MAYBE); } catch(Error e){ debugPrintThrowable(e); throw new org.omg.CORBA.MARSHAL("Unable to read value from underlying bridge : " + e.getMessage(), MinorCodes.VALUEHANDLER_READ_ERROR, CompletionStatus.COMPLETED_MAYBE); } } } handleEndOfValue(); readEndTag(); // Put into valueCache if (valueCache == null) valueCache = new CacheTable(false); valueCache.put(value, indirection); // allow for possible continuation chunk isChunked = saveIsChunked; start_block(); return (java.io.Serializable)value; } } public Serializable read_value(BoxedValueHelper factory) { // Read value tag int vType = readValueTag(); if (vType == 0) return null; // value is null else if (vType == 0xffffffff) { // Indirection tag int indirection = read_long() + get_offset() - 4; if (valueCache != null && valueCache.containsVal(indirection)) { java.io.Serializable cachedValue = (java.io.Serializable)valueCache.getKey(indirection); return cachedValue; } else { throw new IndirectionException(indirection); } } else { int indirection = get_offset() - 4; // end_block(); boolean saveIsChunked = isChunked; isChunked = repIdUtil.isChunkedEncoding(vType); java.lang.Object value = null; String codebase_URL = null; if (repIdUtil.isCodeBasePresent(vType)){ codebase_URL = read_codebase_URL(); } // Read repository id String repositoryIDString = null; switch(repIdUtil.getTypeInfo(vType)){ case RepositoryIdUtility.NO_TYPE_INFO : throw new org.omg.CORBA.MARSHAL("No class description available (value_tag indicates no type information present)"); case RepositoryIdUtility.SINGLE_REP_TYPE_INFO : repositoryIDString = read_repositoryId(); break; case RepositoryIdUtility.PARTIAL_LIST_TYPE_INFO : repositoryIDString = read_repositoryIds(); break; } // Compare rep. ids to see if we should use passed helper if (!repositoryIDString.equals(factory.get_id())) factory = Utility.getHelper(null, codebase_URL, repositoryIDString); start_block(); end_flag--; if (isChunked) chunkedValueNestingLevel--; if (factory instanceof ValueHelper) { value = readIDLValueWithHelper((ValueHelper)factory, indirection); } else { valueIndirection = indirection; // for callback value = factory.read_value(parent); } handleEndOfValue(); readEndTag(); // Put into valueCache if (valueCache == null) valueCache = new CacheTable(false); valueCache.put(value, indirection); // allow for possible continuation chunk isChunked = saveIsChunked; start_block(); return (java.io.Serializable)value; } } private boolean isCustomType(ValueHelper helper) { try{ TypeCode tc = helper.get_type(); int kind = tc.kind().value();
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?