Difference Between Serialization and Externalization:
Serialization | Externalization |
1) It is meant for defualt Serialization. | 1) It is meant for customized Serialization. |
2) Here Every thing takes care by JVM and Programmer doesn't have any control. | 2) Here Everything takes care by Programmer and JVM doesn't have any control. |
3) In Serialization total Object will be Saved to the file always whether it is required or not. | 3) In Externalization Based on our requirement we can save either total Object or part of it. |
4) Relatively Performance is low. | 4) Relatively Performace is high. |
5) Serialization is the best choice if we want to save total object to file. | 5) Externalization is the best choice if we want to save part of the object to file. |
6) Serializable Interface doesn't contain any method. It is marker Interface. | 6) Externalizable interface contains 2 methods, writeExternal() and readExternal(). So it is not maker Interface. |
7) Serializable implements class not required to contain public no-arguement constructor. | 7) Externalizable implemented class should compulsory contain public no-arguement constructor. Otherwise, we will get RuntimeExcpetion Saying InvalidClassException. |
8) tranisent keyword will play role in serialization | 8) transient keyword won'y play any role in Externalization. Of course it is not required. |
0 comments:
Post a Comment