Results 1 to 2 of 2
Thread: What is Serializing good for?
- 02-10-2013, 02:08 PM #1
Member
- Join Date
- Feb 2013
- Posts
- 1
- Rep Power
- 0
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,
Daniel
- 02-10-2013, 06:22 PM #2
Senior Member
- Join Date
- Oct 2011
- Location
- Sweden
- Posts
- 123
- Rep Power
- 0
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
-
Serializing objects
By kev670 in forum New To JavaReplies: 1Last Post: 04-03-2011, 07:05 PM -
Serializing
By shashanksworld in forum New To JavaReplies: 7Last Post: 03-29-2010, 04:47 PM -
Hello Good Morning, Good afternoon, and Good Evening
By MrFreeweed in forum IntroductionsReplies: 3Last Post: 12-11-2009, 03:32 PM -
Object not serializing
By MamboBanda in forum New To JavaReplies: 1Last Post: 08-12-2008, 12:15 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks