Example usage for java.io ObjectInputStream registerValidation

List of usage examples for java.io ObjectInputStream registerValidation

Introduction

In this page you can find the example usage for java.io ObjectInputStream registerValidation.

Prototype

public void registerValidation(ObjectInputValidation obj, int prio)
        throws NotActiveException, InvalidObjectException 

Source Link

Document

Register an object to be validated before the graph is returned.

Usage

From source file:Main.java

private String readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {

    ObjectInputStream.GetField gf = in.readFields();

    in.registerValidation(this, 0);

    return (String) gf.get("s", null);
}

From source file:org.jfree.data.general.AbstractDataset.java

/**
 * Restores a serialized object.//from  w  w  w .java2s . c o  m
 *
 * @param stream  the input stream.
 *
 * @throws IOException if there is an I/O problem.
 * @throws ClassNotFoundException if there is a problem loading a class.
 */
private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException {
    stream.defaultReadObject();
    this.listenerList = new EventListenerList();
    stream.registerValidation(this, 10); // see comments about priority of
                                         // 10 in validateObject()
}