Basics of Serialization and its Type - Serialization is the process of encoding an object or class into a persistent or transportable state. This allows you to take a complex data type, then encode, save, transfer, and decode it, with the possibility that a separate process handles the decoding. |
|
Business Related Topics...
Computer Related Topics...
Entertainment, Recreation & Sports Related Topics...
Health & Fitness Related Topics...
Home & Family Related Topics...
Shopping Related Topics...
Would you like to submit articles to our site? Have a question or a problem?
You are here: DIME Home > Programming and Scripting > Basics of Serialization and its Type
Serialization is the process of encoding an object or class into a persistent or transportable state. This allows you to take a complex data type, then encode, save, transfer, and decode it, with the possibility that a separate process handles the decoding.
Author: Venkatesh Pai
Date: Nov 25, 2009 - 12:12:40 PM
Serialization is the process of encoding an object or class into a persistent or transportable state. This allows you to take a complex data type, then encode, save, transfer, and decode it, with the possibility that a separate process handles the decoding.
There are two main
serialization types:
• Binary serialization - Takes the data type and converts it into a binary stream.
• XML serialization - Converts the data type into an XML stream which you can then convert to an XML document.
You can take the output from either serialization type and store it in memory, place it into a file, or pass it across a network connection. For example, your application may have a defined Customer Data complex data type which stores information about a customer (such as name, address, telephone number, and so on). You can use serialization to convert the Customer Data data type into a binary or XML stream that you can then transport across process boundaries or save to a file for later use. The object is serialized when it is in the binary or XML format.
De-serialization is the process of converting a serialized object back to its original form. Generally, you de-serialize objects back into their original type. Hence, if you serialize the Customer Data data type as a binary stream or as an XML document, you de-serialize it back to the data type Customer Data and not to the data type Order Data.
Both .NET and J2EE use serialization to exchange data between applications within the same platform. You can also use serialization to exchange data between applications on different platforms by passing serialized objects for de-serialization on the alternate platform. The next sections examine how to implement binary and XML serialization on .NET and Java.
Binary serialization is the process of taking a complex data type (or object) and encoding it into a binary stream, changing to a persistent state, transporting, and then decoding (de-serialize) back into the original complex data type.
Both Java and .NET include a binary serializer that can convert any serializeable data type into a byte stream. The classes that perform this serialization are similar in each platform and simple to implement.
For binary serialization in both .NET and Java, you must first apply a label to indicate that you want to serialize a type. In .NET, you can use the [Serializable] attribute or implement the Serializable interface. In Java, the equivalent approach is to make the class implement java io. serializable.
Unfortunately, the .NET and Java serializes are incompatible. Hence, you cannot stream the serialized version of the Customer Data object output from the Java serializer straight into the .NET version and vice versa. Even if you could, you would still face the challenge of getting the .NET Framework application to understand the Customer Data object that the Java serializer produced. The .NET side may not have an equivalent Customer Data data type to accept the de-serialized Customer Data object from the Java side.
You can use binary serialization for linking .NET to Java as long as the same formatter performs the serialization and de-serialization of an object. The format that creates the byte stream from the data type must match exactly the format that receives the byte stream and reconstructs the object.
There are two
approaches that you can use to circumvent the incompatibility of the default
J2EE and .NET binary serializers. These are:
• Create a custom serializer sharing the same formatting options on both Java and .NET.
• Use a third-party product that works with the binary formatter in the .NET Framework, such as Ja.NET or JNBridgePro.
XML serialization is the process of taking a complex data type (or object) and encoding it into an XML stream. You can then make this XML stream into a persistent state in the form of an XML document, transport it, and then later decode (de-serialize) it back into the original complex data type (or object).
In order to understand the process of XML serialization, you need to have a basic understanding of XML. XML is text-based document markup language that contains structured and extensible data. XML is text-based, so you can read it like normal text and because it is extensible, you can use it to describe almost any type of information. Hence XML documents can contain:
• Text
• Pictures
• Program settings
• Data schemas
• Annotations
• Inserts
Spec
HTML5 - The End of PSD to HTML Slicing Providers?Oct 18, 2010 - 11:20:32 AM In 2009 the World Wide Web Consortium (W3C) decided to concentrate their efforts on HTML5, a new revision of HTML, rather than XHTML2. HTML5 is strongly supported by Apple, Opera, Mozilla, Microsoft, Google and other leading IT companies and web browser developers. All this means that HTML5 is becoming a mainstream of the Internet.... [Read the full story] |
Top 10 Points to Remember While Doing Web DevelopmentSep 17, 2010 - 6:44:25 AM The web developers have a vital role to play in the success of the online business as they are actual programmers of the web site. No one is going to fence on the fame of the web development in today’s competitive world. This is a high tech decade and you have to be on your toes all the time to contend well. The design of the website sets the tone for the success. If its attractive people would love it but if it’s not they are going to leave the page next moment.... [Read the full story] |
Top 5 PHP Frame Work List to speed up your Programming efficiencyJan 9, 2010 - 3:23:32 AM PHP is a widely used and open source scripting language which designed for web development to build dynamic web pages. PHP Applications are normally hosted or found on Linux Servers. Its functionality same as Windows platform by Active Server Pages Technology.... [Read the full story] |
Ethical Hacking for Strong SecurityJan 7, 2010 - 12:53:55 PM Ethical hacking is a process that utilizes the same techniques that malicious hackers use, but for the purpose of assessing security threats to your organization’s information assets. Entities of all types (private businesses, government agencies, non-profit corporations, Hospitals, Universities, Etc.) need strong IT security now more than ever. It is imperative that IT security personnel learn “Black Hat” (malicious) hacking techniques in order to counter or prevent attacks on critical IT systems and assets.... [Read the full story] |
Search for articles: |
Latest Articles in All Categories |
Putting Up a Small Commercial Printing Business |
So You Might Be Unemployed And Desire To Become A San Francisco Real Estate Investor Now |
Meditation and Mindfulness: Dealing With Emotion |
CPA Websites: Five Essential Ideas for Composing Convincing Articles |
Set Goals In Order to Come Up With Your Action Plan |
Is the Air in Your Home Safe to Breathe? |
Coarse Fishing Tackle Review: The JW Young 13ft Trotter Rod |
Section 1031 Exchanges For San Diego Real Estate Investors |
Phoenix Real Estate Investing For Highest Possible Earnings |
Legendary are the Volk Racing TE37 Wheels |
Developing the Next Generation Wall Station (ChaseDesk™) for Healthcare - A Case Study |
What are step down transformers? |
Introducing Sharehype, the Revolutionary Tool for Online Marketers |
Rewards To Shopping For Austin Real Estate On The Web |
Hydroponics for Beginners |
Would you like submit your articles and have them approved on a priority status? Find out more about how you can become a Priority author for pennies a day! Click here.
Dime-co.com Home |
|
|
|
|
|
|
|
|
|
|
|
|
|
Disclaimer: Dime-Co.Com is an online information article and video article network. All articles, video articles, comments, and other features herein are for informational purposes only and are provided "as is" without warranties, representations or guarantees of any kind. The views and opinions expressed in an article, comments, links or blogs are the author's own, and not necessarily those of dime-co.com's owners. For full disclaimer, please read our TOS.