|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Serializable
Why would I need to implement the Serializable interface and what does it do?
|
|
#2
|
|||
|
|||
|
it implements the possibility to write your class´s state to a stream. "state" refering here to anything you need/want.
you can eg. implement "save" functions for text fields and user-defined GUIs (i.e. the user can modify his GUI layout and the layout is restored on re-starting the app). and many more.... "serializing" is the process where you store all important information for a class into a stream (even a string? - not sure...)
__________________
-- Manuel Hirsch - Linux, FreeBSD, programming, administration articles, tutorials and more. |
|
#3
|
|||
|
|||
|
Serialization allows you to maintain persistence across machine reboots, networks etc. via (as mentioned before) sending it to a byte stream. This stream can be written to a file & then the object recreated (including state), called deserialization once returned to the Java environment.
Objects can also be "piped" to another Java enabled machine via RMI (Remote Method Invocation)...actually its very cool stuff but has a bit of a learning curve. Fields that will NOT be saved during the serialization process are marked transient, static variables will also not be saved. If you new to the game I wouldnt worry about this quite yet. Once you have the basics & some advanced ideas soaked up then you can dive into this.
__________________
DC Dalton DCD Designs SCJP |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Java Help > Serializable |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|