ObjectInputValidation


ObjectInputValidation java.io

Java 1.1

A class implements this interface and defines the validateObject( ) method in order to validate itself when it and all the objects it depends on have been completely deserialized from an ObjectInputStream . The validateObject( ) method is only invoked, however, if the object is passed to ObjectInputStream.registerValidation( ) ; this must be done from the readObject( ) method of the object. Note that if an object is deserialized as part of a larger object graph, its validateObject( ) method is not invoked until the entire graph is read, and the original call to ObjectInputStream.readObject( ) is about to return. validateObject( ) should throw an InvalidObjectException if the object fails validation. This stops object serialization, and the original call to ObjectInputStream.readObject( ) terminates with the InvalidObjectException exception.

 public interface  ObjectInputValidation  {  // Public Instance Methods  void  validateObject  ( ) throws InvalidObjectException;   } 

Passed To

ObjectInputStream.registerValidation( )



Java In A Nutshell
Java In A Nutshell, 5th Edition
ISBN: 0596007736
EAN: 2147483647
Year: 2004
Pages: 1220

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net