Java Code Examples for java.io.ObjectStreamClass#getSerialVersionUID()
The following examples show how to use
java.io.ObjectStreamClass#getSerialVersionUID() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestObjectStreamClass.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
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(); }
Example 2
Source File: TestObjectStreamClass.java From hottub with GNU General Public License v2.0 | 6 votes |
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(); }
Example 3
Source File: TestObjectStreamClass.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
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(); }
Example 4
Source File: TestObjectStreamClass.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
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(); }
Example 5
Source File: CollectiveClassifierSplitEvaluator.java From collective-classification-weka-package with GNU General Public License v3.0 | 6 votes |
/** * Updates the options that the current classifier is using. */ @Override protected void updateOptions() { if (m_Template instanceof OptionHandler) { m_ClassifierOptions = Utils.joinOptions(((OptionHandler) m_Template) .getOptions()); } else { m_ClassifierOptions = ""; } if (m_Template instanceof Serializable) { ObjectStreamClass obs = ObjectStreamClass.lookup(m_Template.getClass()); m_ClassifierVersion = "" + obs.getSerialVersionUID(); } else { m_ClassifierVersion = ""; } }
Example 6
Source File: TestObjectStreamClass.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
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(); }
Example 7
Source File: SerialVer.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
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; } }
Example 8
Source File: InstantiationUtil.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
@Override protected ObjectStreamClass readClassDescriptor() throws IOException, ClassNotFoundException { ObjectStreamClass streamClassDescriptor = super.readClassDescriptor(); try { Class.forName(streamClassDescriptor.getName(), false, classLoader); } catch (ClassNotFoundException e) { final ObjectStreamClass equivalentSerializer = MigrationUtil.getEquivalentSerializer(streamClassDescriptor.getName()); if (equivalentSerializer != null) { return equivalentSerializer; } } final Class localClass = resolveClass(streamClassDescriptor); final String name = localClass.getName(); if (scalaSerializerClassnames.contains(name) || scalaTypes.contains(name) || isAnonymousClass(localClass) || isOldAvroSerializer(name, streamClassDescriptor.getSerialVersionUID())) { final ObjectStreamClass localClassDescriptor = ObjectStreamClass.lookup(localClass); if (localClassDescriptor != null && localClassDescriptor.getSerialVersionUID() != streamClassDescriptor.getSerialVersionUID()) { LOG.warn("Ignoring serialVersionUID mismatch for class {}; was {}, now {}.", streamClassDescriptor.getName(), streamClassDescriptor.getSerialVersionUID(), localClassDescriptor.getSerialVersionUID()); streamClassDescriptor = localClassDescriptor; } } return streamClassDescriptor; }
Example 9
Source File: SerialVer.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
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; } }
Example 10
Source File: Rittner_Agilent7700_RawDataTemplate.java From ET_Redux with Apache License 2.0 | 5 votes |
private void readObject( ObjectInputStream stream) throws IOException, ClassNotFoundException { stream.defaultReadObject(); ObjectStreamClass myObject = ObjectStreamClass.lookup( Class.forName(Rittner_Agilent7700_RawDataTemplate.class.getCanonicalName())); long theSUID = myObject.getSerialVersionUID(); System.out.println("Customized De-serialization of Rittner_Agilent7700_RawDataTemplate " + theSUID); }
Example 11
Source File: SerialVer.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
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; } }
Example 12
Source File: RittnerAgilent7700FileHandler.java From ET_Redux with Apache License 2.0 | 5 votes |
private void readObject( ObjectInputStream stream) throws IOException, ClassNotFoundException { stream.defaultReadObject(); ObjectStreamClass myObject = ObjectStreamClass.lookup( Class.forName(RittnerAgilent7700FileHandler.class.getCanonicalName())); long theSUID = myObject.getSerialVersionUID(); System.out.println("Customized De-serialization of RittnerAgilent7700FileHandler " + theSUID); }
Example 13
Source File: LevenbergMarquardGeneralSolverWithVecV.java From ET_Redux with Apache License 2.0 | 5 votes |
private void readObject( ObjectInputStream stream) throws IOException, ClassNotFoundException { stream.defaultReadObject(); ObjectStreamClass myObject = ObjectStreamClass.lookup( Class.forName(LevenbergMarquardGeneralSolverWithVecV.class.getCanonicalName())); long theSUID = myObject.getSerialVersionUID(); System.out.println("Customized De-serialization of LevenbergMarquardGeneralSolverWithVecV " + theSUID); }
Example 14
Source File: InstantiationUtil.java From flink with Apache License 2.0 | 5 votes |
@Override protected ObjectStreamClass readClassDescriptor() throws IOException, ClassNotFoundException { ObjectStreamClass streamClassDescriptor = super.readClassDescriptor(); try { Class.forName(streamClassDescriptor.getName(), false, classLoader); } catch (ClassNotFoundException e) { final ObjectStreamClass equivalentSerializer = MigrationUtil.getEquivalentSerializer(streamClassDescriptor.getName()); if (equivalentSerializer != null) { return equivalentSerializer; } } final Class localClass = resolveClass(streamClassDescriptor); final String name = localClass.getName(); if (scalaSerializerClassnames.contains(name) || scalaTypes.contains(name) || isAnonymousClass(localClass) || isOldAvroSerializer(name, streamClassDescriptor.getSerialVersionUID())) { final ObjectStreamClass localClassDescriptor = ObjectStreamClass.lookup(localClass); if (localClassDescriptor != null && localClassDescriptor.getSerialVersionUID() != streamClassDescriptor.getSerialVersionUID()) { LOG.warn("Ignoring serialVersionUID mismatch for class {}; was {}, now {}.", streamClassDescriptor.getName(), streamClassDescriptor.getSerialVersionUID(), localClassDescriptor.getSerialVersionUID()); streamClassDescriptor = localClassDescriptor; } } return streamClassDescriptor; }
Example 15
Source File: SerialVer.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
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; } }
Example 16
Source File: SerialVer.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
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; } }
Example 17
Source File: Kosler_Agilent7700_RawDataTemplate.java From ET_Redux with Apache License 2.0 | 5 votes |
private void readObject( ObjectInputStream stream) throws IOException, ClassNotFoundException { stream.defaultReadObject(); ObjectStreamClass myObject = ObjectStreamClass.lookup( Class.forName(Kosler_Agilent7700_RawDataTemplate.class.getCanonicalName())); long theSUID = myObject.getSerialVersionUID(); System.out.println("Customized De-serialization of Kosler_Agilent7700_RawDataTemplate " + theSUID); }
Example 18
Source File: SerialVer.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
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; } }
Example 19
Source File: SerializablePortability.java From offheap-store with Apache License 2.0 | 5 votes |
public SerializableDataKey(ObjectStreamClass desc, boolean store) throws IOException { Class<?> forClass = desc.forClass(); if (forClass != null) { if (store) { throw new AssertionError("Must not store ObjectStreamClass instances with strong references to classes"); } else if (ObjectStreamClass.lookup(forClass) == desc) { this.klazz = new WeakReference<>(forClass); } } this.hashCode = (3 * desc.getName().hashCode()) ^ (7 * (int) (desc.getSerialVersionUID() >>> 32)) ^ (11 * (int) desc.getSerialVersionUID()); this.osc = desc; }
Example 20
Source File: ObjectStreamFieldTest.java From j2objc with Apache License 2.0 | 5 votes |
public ObjectStreamClass readClassDescriptor() throws IOException, ClassNotFoundException { ObjectStreamClass osc = super.readClassDescriptor(); // To get the ObjectStreamClass of SerializableObject if (osc.getSerialVersionUID() == -2953957835918368056L) { temp = osc; } return osc; }