How to lock serialization in Java? -
i starting java serialization: have 1 exercise , need lock serialization on class, suppose throw exception when attempt serialize class.
does know how it?
if add implementation of writeobject
throws exception, serialization aborted, e.g.
private void writeobject(objectoutputstream stream) throws ioexception { throw new runtimeexception("don't want serialize today"); }
see http://java.sun.com/developer/technicalarticles/alt/serialization/ introduction overriding default serialization behaviour.
Comments
Post a Comment