📄 valuehandlerimpl.java
字号:
try { jdkToOrbInputStreamBridge.increaseRecursionDepth(); result = (java.io.Serializable) readValueInternal(jdkToOrbInputStreamBridge, in, offset, clazz, repositoryID, sender); } finally { if (jdkToOrbInputStreamBridge.decreaseRecursionDepth() == 0) { inputStreamPairs.remove(_in); } } return result; } private java.io.Serializable readValueInternal(IIOPInputStream bridge, org.omg.CORBA_2_3.portable.InputStream in, int offset, java.lang.Class clazz, String repositoryID, com.sun.org.omg.SendingContext.CodeBase sender) { java.io.Serializable result = null; if (clazz == null) { // clazz == null indicates an FVD situation for a nonexistant class if (isArray(repositoryID)){ read_Array(bridge, in, null, sender, offset); } else { bridge.simpleSkipObject(repositoryID, sender); } return result; } if (clazz.isArray()) { result = (java.io.Serializable)read_Array(bridge, in, clazz, sender, offset); } else { result = (java.io.Serializable)bridge.simpleReadObject(clazz, repositoryID, sender, offset); } return result; } /** * Returns the repository ID for the given RMI value Class. * @param clz The class to return a repository ID for. * @return the repository ID of the Class. **/ public java.lang.String getRMIRepositoryID(java.lang.Class clz) { return RepositoryId.createForJavaType(clz); } /** * Indicates whether the given Class performs custom or * default marshaling. * @param clz The class to test for custom marshaling. * @return True if the class performs custom marshaling, false * if it does not. **/ public boolean isCustomMarshaled(java.lang.Class clz) { return ObjectStreamClass.lookup(clz).isCustomMarshaled(); } /** * Returns the CodeBase for this ValueHandler. This is used by * the ORB runtime. The server sends the service context containing * the IOR for this CodeBase on the first GIOP reply. The clients * do the same on the first GIOP request. * @return the SendingContext.CodeBase of this ValueHandler. **/ public org.omg.SendingContext.RunTime getRunTimeCodeBase() { if (codeBase != null) return codeBase; else { codeBase = new FVDCodeBaseImpl(); // backward compatability 4365188 // set the valueHandler so that correct/incorrect RepositoryID // calculations can be done based on the ORB version FVDCodeBaseImpl fvdImpl = (FVDCodeBaseImpl) codeBase; fvdImpl.setValueHandler(this); return codeBase; } } // methods supported for backward compatability so that the appropriate // Rep-id calculations take place based on the ORB version /** * Returns a boolean of whether or not RepositoryId indicates * FullValueDescriptor. * used for backward compatability */ public boolean useFullValueDescription(Class clazz, String repositoryID) throws IOException { return RepositoryId.useFullValueDescription(clazz, repositoryID); } public String getClassName(String id) { RepositoryId repID = RepositoryId.cache.getId(id); return repID.getClassName(); } public Class getClassFromType(String id) throws ClassNotFoundException { RepositoryId repId = RepositoryId.cache.getId(id); return repId.getClassFromType(); } public Class getAnyClassFromType(String id) throws ClassNotFoundException { RepositoryId repId = RepositoryId.cache.getId(id); return repId.getAnyClassFromType(); } public String createForAnyType(Class cl) { return RepositoryId.createForAnyType(cl); } public String getDefinedInId(String id) { RepositoryId repId = RepositoryId.cache.getId(id); return repId.getDefinedInId(); } public String getUnqualifiedName(String id) { RepositoryId repId = RepositoryId.cache.getId(id); return repId.getUnqualifiedName(); } public String getSerialVersionUID(String id) { RepositoryId repId = RepositoryId.cache.getId(id); return repId.getSerialVersionUID(); } public boolean isAbstractBase(Class clazz) { return RepositoryId.isAbstractBase(clazz); } public boolean isSequence(String id) { RepositoryId repId = RepositoryId.cache.getId(id); return repId.isSequence(); } /** * If the value contains a writeReplace method then the result * is returned. Otherwise, the value itself is returned. * @return the true value to marshal on the wire. **/ public java.io.Serializable writeReplace(java.io.Serializable value) { return ObjectStreamClass.lookup(value.getClass()).writeReplace(value); } /** * Encapsulates writing of Java char arrays so that the 1.3 subclass * can override it without exposing internals across packages. This * is a fix for bug 4367783. */ protected void writeCharArray(org.omg.CORBA_2_3.portable.OutputStream out, char[] array, int offset, int length) { out.write_wchar_array(array, offset, length); } private void write_Array(org.omg.CORBA_2_3.portable.OutputStream out, java.io.Serializable obj, Class type) { int i, length; if (type.isPrimitive()) { if (type == Integer.TYPE) { int[] array = (int[])((Object)obj); length = array.length; out.write_ulong(length); out.write_long_array(array, 0, length); } else if (type == Byte.TYPE) { byte[] array = (byte[])((Object)obj); length = array.length; out.write_ulong(length); out.write_octet_array(array, 0, length); } else if (type == Long.TYPE) { long[] array = (long[])((Object)obj); length = array.length; out.write_ulong(length); out.write_longlong_array(array, 0, length); } else if (type == Float.TYPE) { float[] array = (float[])((Object)obj); length = array.length; out.write_ulong(length); out.write_float_array(array, 0, length); } else if (type == Double.TYPE) { double[] array = (double[])((Object)obj); length = array.length; out.write_ulong(length); out.write_double_array(array, 0, length); } else if (type == Short.TYPE) { short[] array = (short[])((Object)obj); length = array.length; out.write_ulong(length); out.write_short_array(array, 0, length); } else if (type == Character.TYPE) { char[] array = (char[])((Object)obj); length = array.length; out.write_ulong(length); writeCharArray(out, array, 0, length); } else if (type == Boolean.TYPE) { boolean[] array = (boolean[])((Object)obj); length = array.length; out.write_ulong(length); out.write_boolean_array(array, 0, length); } else { // XXX I18N, logging needed. throw new Error("Invalid primitive type : " + obj.getClass().getName()); } } else if (type == java.lang.Object.class) { Object[] array = (Object[])((Object)obj); length = array.length; out.write_ulong(length); for (i = 0; i < length; i++) { Util.writeAny(out, array[i]); } } else { Object[] array = (Object[])((Object)obj); length = array.length; out.write_ulong(length); int callType = kValueType; if (type.isInterface()) { String className = type.getName(); if (java.rmi.Remote.class.isAssignableFrom(type)) { // RMI Object reference... callType = kRemoteType; } else if (org.omg.CORBA.Object.class.isAssignableFrom(type)){ // IDL Object reference... callType = kRemoteType; } else if (RepositoryId.isAbstractBase(type)) { // IDL Abstract Object reference... callType = kAbstractType; } else if (ObjectStreamClassCorbaExt.isAbstractInterface(type)) { callType = kAbstractType; } } for (i = 0; i < length; i++) { switch (callType) { case kRemoteType: Util.writeRemoteObject(out, array[i]); break; case kAbstractType: Util.writeAbstractObject(out,array[i]); break; case kValueType: try{ out.write_value((java.io.Serializable)array[i]); } catch(ClassCastException cce){ if (array[i] instanceof java.io.Serializable) throw cce; else { Utility.throwNotSerializableForCorba( array[i].getClass().getName()); } } break; } } } } /** * Encapsulates reading of Java char arrays so that the 1.3 subclass * can override it without exposing internals across packages. This * is a fix for bug 4367783. */ protected void readCharArray(org.omg.CORBA_2_3.portable.InputStream in,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -