本文整理汇总了Java中com.sun.corba.se.impl.io.ObjectStreamClass.getSerialVersionUID方法的典型用法代码示例。如果您正苦于以下问题:Java ObjectStreamClass.getSerialVersionUID方法的具体用法?Java ObjectStreamClass.getSerialVersionUID怎么用?Java ObjectStreamClass.getSerialVersionUID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sun.corba.se.impl.io.ObjectStreamClass
的用法示例。
在下文中一共展示了ObjectStreamClass.getSerialVersionUID方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: computeSerialVersionUID
import com.sun.corba.se.impl.io.ObjectStreamClass; //导入方法依赖的package包/类
public static long computeSerialVersionUID(final Class cl) {
long csuid = ObjectStreamClass.getSerialVersionUID(cl);
if (csuid == 0)
return csuid; // for non-serializable/proxy classes
csuid = (ObjectStreamClassUtil_1_3.getSerialVersion(csuid, cl).longValue());
return csuid;
}
示例2: createHashString
import com.sun.corba.se.impl.io.ObjectStreamClass; //导入方法依赖的package包/类
private static String createHashString(java.lang.Class clazz) {
if (clazz.isInterface() || !java.io.Serializable.class.isAssignableFrom(clazz))
return kInterfaceHashCode;
//ObjectStreamClass osc = ObjectStreamClass.lookup(clazz);
long actualLong = ObjectStreamClass.getActualSerialVersionUID(clazz);
String hash = null;
if (actualLong == 0)
hash = kInterfaceOnlyHashStr;
else if (actualLong == 1)
hash = kExternalizableHashStr;
else
hash = Long.toHexString(actualLong).toUpperCase();
while(hash.length() < 16){
hash = "0" + hash;
}
long declaredLong = ObjectStreamClass.getSerialVersionUID(clazz);
String declared = null;
if (declaredLong == 0)
declared = kInterfaceOnlyHashStr;
else if (declaredLong == 1)
declared = kExternalizableHashStr;
else
declared = Long.toHexString(declaredLong).toUpperCase();
while (declared.length() < 16){
declared = "0" + declared;
}
hash = hash + ":" + declared;
return ":" + hash;
}