Thread: Serializable

    #1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2002
    Location
    Minnesota
    Posts
    3
    Rep Power
    0

    Serializable


    Why would I need to implement the Serializable interface and what does it do?
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed God 1st Plane (5500 - 5999 posts)

    Join Date
    Oct 2000
    Location
    Back in the real world.
    Posts
    5,966
    Rep Power
    190
    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...)
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2001
    Location
    NE Pa.
    Posts
    96
    Rep Power
    14
    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

IMN logo majestic logo threadwatch logo seochat tools logo