Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Spring Framework | Web Services | BioInformatics | Java Server Faces | Jboss 3.0 tutorial | Hibernate 3.0 | XML

Tutorial Categories: Ajax | Articles | JSP | Bioinformatics | Database | Free Books | Hibernate | J2EE | J2ME | Java | JavaScript | JDBC | JMS | Linux | MS Technology | PHP | RMI | Web-Services | Servlets | Struts | UML

Fresher Job


 

Search Host

Monthly Fee($)
Disk Space (MB)
Register With us for Newsletter!
Visit Forum! Post Questions!
Jobs At RoseIndia.net!

Have tutorials?
Add your tutorial to our Java Resource and get tons of hits.

We offer free hosting for your tutorials. and exposure for thousands of readers. drop a mail
roseindia_net@yahoo.com
 
   

Tutorials

Java Server Pages

JAXB

Java Beans

JDBC

MySQL

Java Servlets

Struts

Bioinformatics

Java Code Examples

Interview Questions

 
Join For Newsletter

Powered by groups.yahoo.com
Visit Group! Post Questions!

Web Promotion

Web Submission

Submit Sites

Manual Submission?

Web Promotion Guide

Hosting Companies

Web Hosting Guide

Web Hosting

Linux

Beginner Guide to Linux Server

Frameworks

Persistence Framework

Web Frameworks

Free EAI Tools

Web Servers

Aspect Oriented Programming

Free Proxy Servers

Softwares

Adware & Spyware Remover

Open Source Softwares

java
Expert:ravurivinodkumar
What is Externalization and how it can be implement in our application?
Can any one please explain me with some examples?


Thanks in advance
Vinod
Answers
Hi friend...


Externalizable interface :

When user use Serializable interface, class is serialized by default but Externalizable interface
provides facility to complete control over serialization process so Externalization is a more advanced
alternative to serialization.
This interface has two methods:
1:- public void writeExternal(ObjectOutput out)
2:- public void readExternal(ObjectInput in)

Every class that usese/implements externalization must implement Externalizable interface and override these methods
and must have a no arguments constructor. These methods are automatically called at the time of serialization
and de-serialization so you can can implement your own serialization-specific operations and have control over what data
to serialize and wat to not.

Example Code :


import java.io.*;

public class MyExternObject implements Externalizable {

int i;
String s;

MyExternObject() {
i = 256;
s = new String("Implementation of interface Externalizable.");
}

public int getI() {
return i;
}

public String getS() {
return s;
}

public void writeExternal(ObjectOutput out) throws
IOException {
out.writeInt(this.i);
out.writeObject(this.s);
}

public void readExternal(ObjectInput in) throws
IOException, ClassNotFoundException {
this.i = in.readInt();
this.s = (String) in.readObject();
}

public static void main(String[] args) throws
IOException, ClassNotFoundException {

MyExternObject externObject = new MyExternObject();
System.out.println(externObject.getS());
System.out.println(externObject.getI());
}
}

Output :
Implementation of interface Externalizable.
256


Thanks..



Read for more information,


http://www.roseindia.net/java/

More Questions
Post Answers
 
Ask Question Facing Programming Problem?
Useful Links
  JDO Tutorials
  EAI Articles
  Struts Tutorials
  Java Tutorials
  Java Certification

Tell A Friend
Your Friend Name
Search Tutorials

 

 
 
Browse all Java Tutorials
Java JSP Struts Servlets Hibernate XML
Ajax JDBC EJB MySQL JavaScript JSF
Maven2 Tutorial JEE5 Tutorial Java Threading Tutorial Photoshop Tutorials Linux Technology
Technology Revolutions Eclipse Spring Tutorial Bioinformatics Tutorials Tools SQL
 

Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs

About Us | Advertising On RoseIndia.net

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2007. All rights reserved.