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

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -