Results 1 to 2 of 2
  1. #1
    javdaniel is offline Member
    Join Date
    Feb 2013
    Rep Power

    Question What is Serializing good for?

    Hey Guys,

    I'm currently reading through the SCJP 6 book and have reached Chapter 6, specifically, Serializing. For me, to grasp and understand something to its' fullest (relatively speaking, of course), I need to understand what it is good for, why it is used, and most importantly, when.

    If you had used Serializing, could you tell me why you did so, and what it was for? I understand that you can save the state of an Object on the file system, I just don't understand where it could be used. Like saving a game, or saving properties to a file, or..?

    Thanks in advance,

  2. #2
    Zyril is offline Senior Member
    Join Date
    Oct 2011
    Rep Power

    Default Re: What is Serializing good for?

    Hi javdaniel,

    there are some really good sites that clarifies this, mostly the Oracle API site for Java itself. It can be found here: Serializable (Java Platform SE 7 )

    To understand when to use it, you have to understand what it is.

    Serialization is a common term for taking an object and turning it into a series of bits, or an ordered stream of bytes. These can later on be read and deserialized into an identical clone of the object that was serialized. Just by thinking of this, I think you can come up with many good usages for this, such as storing information in a file to be sent to another system, or to send something over a network link.

    In Java, you use the interface Serializable to make this happen. If you create a class that has to be able to be serialized, you just implement this interface. The good thing in Java, as far as I has understood is that this is done completely by the JVM and thus makes it possible to transfer the serialized object to any given system that has a JVM that can deserialize the object.

    To use this, take a look at ObjectInputStream and ObjectOutputStream classes.

    I hope this helps!

Similar Threads

  1. Serializing objects
    By kev670 in forum New To Java
    Replies: 1
    Last Post: 04-03-2011, 07:05 PM
  2. Serializing
    By shashanksworld in forum New To Java
    Replies: 7
    Last Post: 03-29-2010, 04:47 PM
  3. Hello Good Morning, Good afternoon, and Good Evening
    By MrFreeweed in forum Introductions
    Replies: 3
    Last Post: 12-11-2009, 03:32 PM
  4. Object not serializing
    By MamboBanda in forum New To Java
    Replies: 1
    Last Post: 08-12-2008, 12:15 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts