banner image
Sedang Dalam Perbaikan

How can we prevent serialization?


How can we prevent serialization?

-) Often there is no need to serialize sockets, streams & DB connections etc because they do no represent the state of object, rather connections to external resources
-) To do so, transient keyword is used to mark a field that should not be serialized
-) So we can mark them as,
o transient Socket s; o transient OutputStream os; o transient Connecction con;
-) Transient fields are returned as nullon reading
How can we prevent serialization? How can we prevent serialization? Reviewed by MCH on April 27, 2014 Rating: 5

No comments:

Powered by Blogger.