本文整理匯總了Java中java.io.ObjectStreamClass.getSerialVersionUID方法的典型用法代碼示例。如果您正苦於以下問題:Java ObjectStreamClass.getSerialVersionUID方法的具體用法?Java ObjectStreamClass.getSerialVersionUID怎麽用?Java ObjectStreamClass.getSerialVersionUID使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類java.io.ObjectStreamClass
的用法示例。
在下文中一共展示了ObjectStreamClass.getSerialVersionUID方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: readClassDescriptor
import java.io.ObjectStreamClass; //導入方法依賴的package包/類
protected ObjectStreamClass readClassDescriptor() throws IOException, ClassNotFoundException {
ObjectStreamClass resultClassDescriptor = super.readClassDescriptor();
Class localClass;
try {
localClass = Class.forName(resultClassDescriptor.getName());
} catch (ClassNotFoundException e) {
return resultClassDescriptor;
}
ObjectStreamClass localClassDescriptor = ObjectStreamClass.lookup(localClass);
if (localClassDescriptor != null) {
final long localSUID = localClassDescriptor.getSerialVersionUID();
final long streamSUID = resultClassDescriptor.getSerialVersionUID();
if (streamSUID != localSUID) {
resultClassDescriptor = localClassDescriptor;
}
}
return resultClassDescriptor;
}
示例2: main
import java.io.ObjectStreamClass; //導入方法依賴的package包/類
public static void main(String[] args) throws Exception {
ByteArrayOutputStream byteOutput = new ByteArrayOutputStream();
ObjectOutputStream output = new ObjectOutputStream(byteOutput);
output.writeObject(new TestClass());
ByteArrayInputStream bais = new ByteArrayInputStream(byteOutput.toByteArray());
TestObjectInputStream input = new TestObjectInputStream(bais);
input.readObject();
ObjectStreamClass osc = input.getDescriptor();
// All OSC public API methods should complete without throwing.
osc.getName();
osc.forClass();
osc.getField("str");
osc.getFields();
osc.getSerialVersionUID();
osc.toString();
}
示例3: readObject
import java.io.ObjectStreamClass; //導入方法依賴的package包/類
private void readObject(
ObjectInputStream stream)
throws IOException, ClassNotFoundException {
stream.defaultReadObject();
ObjectStreamClass myObject = ObjectStreamClass.lookup(Class.forName(Average.class.getCanonicalName()));
long theSUID = myObject.getSerialVersionUID();
System.out.println("Customized De-serialization of Average " + theSUID);
}
示例4: readObject
import java.io.ObjectStreamClass; //導入方法依賴的package包/類
private void readObject(
ObjectInputStream stream)
throws IOException, ClassNotFoundException {
stream.defaultReadObject();
ObjectStreamClass myObject = ObjectStreamClass.lookup(Class.forName(Exp.class.getCanonicalName()));
long theSUID = myObject.getSerialVersionUID();
System.out.println("Customized De-serialization of Exp " + theSUID);
}
示例5: readObject
import java.io.ObjectStreamClass; //導入方法依賴的package包/類
private void readObject(
ObjectInputStream stream)
throws IOException, ClassNotFoundException {
stream.defaultReadObject();
ObjectStreamClass myObject = ObjectStreamClass.lookup(Class.forName(Count.class.getCanonicalName()));
long theSUID = myObject.getSerialVersionUID();
System.out.println("Customized De-serialization of Count " + theSUID);
}
示例6: readObject
import java.io.ObjectStreamClass; //導入方法依賴的package包/類
private void readObject(
ObjectInputStream stream)
throws IOException, ClassNotFoundException {
stream.defaultReadObject();
ObjectStreamClass myObject = ObjectStreamClass.lookup(Class.forName(Max.class.getCanonicalName()));
long theSUID = myObject.getSerialVersionUID();
System.out.println("Customized De-serialization of Max " + theSUID);
}
示例7: resolveClass
import java.io.ObjectStreamClass; //導入方法依賴的package包/類
static String resolveClass(String classname) throws ClassNotFoundException {
Class<?> cl = Class.forName(classname, false, loader);
ObjectStreamClass desc = ObjectStreamClass.lookup(cl);
if (desc != null) {
return " private static final long serialVersionUID = " +
desc.getSerialVersionUID() + "L;";
} else {
return null;
}
}
示例8: resolveClass
import java.io.ObjectStreamClass; //導入方法依賴的package包/類
@Override protected Class<?> resolveClass(final ObjectStreamClass desc)
throws IOException, ClassNotFoundException {
return (Switcheroo.serialVersionUID == desc.getSerialVersionUID()) ? AesCounterRandom.class
: super.resolveClass(desc);
}