當前位置: 首頁>>代碼示例>>Java>>正文


Java ObjectStreamClass.getSerialVersionUID方法代碼示例

本文整理匯總了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;
}
 
開發者ID:d2si-oss,項目名稱:ooso,代碼行數:19,代碼來源:DecompressibleInputStream.java

示例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();
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:20,代碼來源:TestObjectStreamClass.java

示例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);
}
 
開發者ID:CIRDLES,項目名稱:Squid,代碼行數:9,代碼來源:Average.java

示例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);
}
 
開發者ID:CIRDLES,項目名稱:Squid,代碼行數:9,代碼來源:Exp.java

示例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);
}
 
開發者ID:CIRDLES,項目名稱:Squid,代碼行數:9,代碼來源:Count.java

示例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);
}
 
開發者ID:CIRDLES,項目名稱:Squid,代碼行數:9,代碼來源:Max.java

示例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;
    }
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:11,代碼來源:SerialVer.java

示例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);
}
 
開發者ID:Pr0methean,項目名稱:BetterRandom,代碼行數:6,代碼來源:BaseRandomStaticTest.java


注:本文中的java.io.ObjectStreamClass.getSerialVersionUID方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。