本文整理汇总了Java中com.sun.corba.se.spi.ior.iiop.IIOPProfile.getTaggedProfileTemplate方法的典型用法代码示例。如果您正苦于以下问题:Java IIOPProfile.getTaggedProfileTemplate方法的具体用法?Java IIOPProfile.getTaggedProfileTemplate怎么用?Java IIOPProfile.getTaggedProfileTemplate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sun.corba.se.spi.ior.iiop.IIOPProfile
的用法示例。
在下文中一共展示了IIOPProfile.getTaggedProfileTemplate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getEncodingVersion
import com.sun.corba.se.spi.ior.iiop.IIOPProfile; //导入方法依赖的package包/类
/**
* @return the Java serialization encoding version.
*/
public static byte getEncodingVersion(ORB orb, IOR ior) {
// Is Java serialization enabled?
// Check the JavaSerializationComponent (tagged component)
// in the IIOPProfile. If present, the peer ORB's GIOP is capable
// of using Java serialization instead of CDR serialization.
// In such a case, use Java serialization, iff the java serialization
// versions match.
if (orb.getORBData().isJavaSerializationEnabled()) {
IIOPProfile prof = ior.getProfile();
IIOPProfileTemplate profTemp =
(IIOPProfileTemplate) prof.getTaggedProfileTemplate();
java.util.Iterator iter = profTemp.iteratorById(
ORBConstants.TAG_JAVA_SERIALIZATION_ID);
if (iter.hasNext()) {
JavaSerializationComponent jc =
(JavaSerializationComponent) iter.next();
byte jcVersion = jc.javaSerializationVersion();
if (jcVersion >= Message.JAVA_ENC_VERSION) {
return Message.JAVA_ENC_VERSION;
} else if (jcVersion > Message.CDR_ENC_VERSION) {
return jc.javaSerializationVersion();
} else {
// throw error?
// Since encodingVersion is <= 0 (CDR_ENC_VERSION).
}
}
}
return Message.CDR_ENC_VERSION; // default
}