Results 1 to 5 of 5

Thread: What is Externalization in java?

  1. #1
    Join Date
    Dec 2009
    Posts
    38

    What is Externalization in java?

    Hi friends,

    I have to discuss one concept of Java programming. I want to be aware about the Externalization concept of java language. I don't have any idea about use of this concept. I referred some book but seems quit complex to understand. It will be great if you are able to provide something about the Externalization concept of java programming. Your any help would be appreciable.

  2. #2
    Join Date
    Oct 2005
    Posts
    2,393

    Re: What is Externalization in java?

    Hi friend,

    Externalization concept of Java programming is identical to the Sterilization concept of java. But there is only difference is that, In Sterilization the ReadObject() and WriteObject() method are called by using the JVM. Externalization in java is essential for to hold the extra information into the object. For example the storing of transient variables or static variable into the object.

  3. #3
    Join Date
    May 2008
    Posts
    2,389

    Re: What is Externalization in java?

    When the super type of an externalization object is also externalization, the subclass object used to invoke the readExternal and writeExternal method of its super class. The object of the externalization is used for to implement the writeExternal() for to save the state of the object and a readExternal() method for to restore the state of the object. The object of the externalization also used for to coordinate with super type in the way to restore and to save its state.

  4. #4
    Join Date
    Feb 2008
    Posts
    1,852

    Re: What is Externalization in java?

    Externalization in java enable the customization of how serialization is to be implemented . Remember all EJB the implementation of the Serializable interface which is done indirectly. When serialization is made than an object of the Externalizable as well as the default constructor will be automatically called. There is also an overhead involved because the run time has to call methods of your program to write or read objects.

  5. #5
    Join Date
    Jan 2008
    Posts
    1,521

    Re: What is Externalization in java?

    Hi, Please refer following java example for Externalization:
    import java.io.*;
    import java.util.*;
    class Datat implements ExternalizableDemo {
    inti;
    String sp;
    public Datat() {
    System.out.println("Data default constructor");
    }
    public Datta(String xp, int ap) {
    System.out.println("Second constructor");
    sp = xp; ip = ap;
    }
    public String toString() {
    return sp + ip;
    }
    public void writeExternal(ObjectOutput out)
    throws IOException {
    out.writeObject(sp);
    out.writeInt(ip);
    }
    public void readExternal(ObjectInput in) {
    sp = (String)in.readObject();
    ip = in.readInt();
    }
    public static void main(String[] args)
    throws IOException, ClassNotFoundException {
    Data dp = new Data("String value",1514);
    System.out.println(dp);
    ObjectOutputStream op = new ObjectOutputStream(
    New FileOutputStream("data.out"));
    op.writeObject(d);
    op.close();

    }
    }

Similar Threads

  1. Replies: 4
    Last Post: 04-09-2013, 11:04 PM
  2. Comparison between core java and advanced java
    By Prashobh Mallu in forum Software Development
    Replies: 5
    Last Post: 19-01-2010, 10:57 AM
  3. How big is an Object in Java? Why Java neglects sizeof?
    By KALINDA in forum Software Development
    Replies: 4
    Last Post: 10-11-2009, 03:19 AM
  4. Link List Example in Java Sample program in Java
    By trickson in forum Software Development
    Replies: 2
    Last Post: 04-08-2009, 08:23 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,711,649,241.79147 seconds with 17 queries