Remember Me
forgot your password?

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.

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

XML documents may also contain instructions about how to use the data within the document itself.

Kamlesh Patel

SPEC India is a Custom Software Application Development and Software Solutions Company based in Ahmedabad, India. Our Services includes Legacy Application Migration and Interfaces, Java Application Development, ORACLE, .Net, and Mobile Computing.

Rate this Article: 0 / 5 stars - 0 vote(s)
Print Email Re-Publish

Add new Comment



Captcha

  • Latest Programming Articles
  • More from Kamlesh Patel

Magento Development

By: Digisha Modi | 26/12/2009
Magento eCommerce Development is an incredibly advanced suite which enables you to have a shopping cart up and running in a very short time. Magento includes advanced reporting and analysis features which will increase your awareness of sales trends and other customer activity to enable you to tune your business for maximum efficiency. Its unique characteristics are unlimited flexibility, completely scalable architecture, professional and community support and smooth integration with 3rd party a

PSD to XHTML Conversion Services

By: Digisha Modi | 26/12/2009
To make a website easily visible and popular, making it browser compatible is very important. For this PSD to XHTML conversion is one of the most vital elements of Web designing. Its growing importance in the designing cannot be completely annulled. With the increasing competition among the web marketers, the importance of a good design with better usability has become the necessity of the present time.

Magento Extension Development

By: Digisha Modi | 26/12/2009
Magento is a feature-rich, professional open-source eCommerce solution that offers merchants complete flexibility and control over the look, content, and functionality of their online store. Magneto’s intuitive administration interface contains powerful marketing, search engine optimization and catalog-management tools to give merchants the power to create sites that are tailored to their unique business needs.

How to burn WMV video to DVD to enjoy on TV, xobx, PS 3 or other playwers

By: lyndon123 | 26/12/2009
WMV video is a one of the most pop format video we often use. Enjoy the WMV video on TV, Xbox, PS 3 or other DVD Players is often necessary in our common life. Now we can follow this simple guide to learn how to burn WMV to DVD Disc.

Mobile antivirus software is beginning to be an essential

By: brookepens | 25/12/2009
When it comes to our home computers and networks in the work place everyone ensures that they are protected by mobile antivirus software with protective firewalls. Unfortunately, there are still many people and businesses that do not realise that mobile phone antivirus software has become just as important to have as antivirus computer software.

NetOffice Customization

By: Digisha Modi | 25/12/2009
NetOffice is a web based project management tools written in PHP and utilizing MySQL. It has a surprisingly easy to use user interface, and it really is self explanatory, even for first time users. It has the same features as most other free web based project management tools but is set apart from the pack by its simple layout and amazing ease of use.

SugarCRM Development Services

By: Digisha Modi | 25/12/2009
SugarCRM is commercial open source Customer Relationship Management software that is designed to meet all the CRM requirements of organizations. It is developed using PHP and available in both free and commercial editions. It provides basic CRM functionality such as lead tracking, sales management, project management, issue tracking etc.

Magento - Best Choice for Ecommerce Solution

By: Digisha Modi | 24/12/2009
Magento eCommerce is a new Open Source platform with industry-leading features to provide merchants with unprecedented control over store operations. This Open Source eCommerce software is very powerful and includes many features that have not been seen in Open Source products before. Magento eCommerce is one of the fastest growing new software, and looks set to become a dominant force in the eCommerce industry.

Basics of Serialization and its Type

By: Kamlesh Patel | 16/11/2009 | Programming
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.

Java Mapping concepts Understanding

By: Kamlesh Patel | 21/10/2009 | Software
Mapping is the way of transforming one XML structure to another XML Structure. As a part of it we do certain operations like breaking child nodes and attaching them to its parent node and more in an XML structure.

Introduction of GPRS network Elements

By: Kamlesh Patel | 18/09/2009 | Programming
GPRS (General Packet Radio Service) represents an evolution of the GSM standard, allowing data transmission in packet mode and providing higher throughputs as compared with the circuit-switched mode.

Software Metrics and its Applications

By: Kamlesh Patel | 18/08/2009 | Programming
Software Metrics is all about measurement which in turn involves numbers; the use of numbers to make things better, to improve the process of developing software and to improve all aspects of the management of that process.

What is application concurrency?

By: Kamlesh Patel | 17/07/2009 | Programming
In a multi-user system or application, concurrency is a major issue that the development team must address. Concurrency, in the context of a software application, is the handling of multiple users attempting to access the same data at the same time.

Recommended Technologies by SAP for Integration

By: Kamlesh Patel | 16/06/2009 | Software
Seamless integration across business applications has always been a critical area of interest for any organization. The criticality of application integration is obvious from the fact that this is often a critical factor in purchase decision making.

Goals of an Enterprise Architecture (J2EE)

By: Kamlesh Patel | 17/05/2009 | Programming
Enterprise software is important to an organization. Its users expect it to be reliable and bug-free. Hence we must understand and take advantage of those parts of J2EE that can help us build robust solutions and must ensure that we write quality code.

Some Important Features of SOAP

By: Kamlesh Patel | 16/04/2009 | Information Technology
The SOAP standard contains the information for how the messages should be sent, the format the XML appears in, the different primitive types supposed, the roles different pieces of software take during the transmission of the SOAP documents, and the type of transports available, such as HTTP.

Submit Your Articles Free: Signup
Article Categories




Use of this web site constitutes acceptance of the Terms Of Use and Privacy Policy | User published content is licensed under a Creative Commons License.
Copyright © 2005-2008 Free Articles by ArticlesBase.com, All rights reserved. (0.23, 5, w3)