I am trying to test the custom serialization but readObject()
method is not being called.Although I am able to call the writeObject method.
Can we overload the readObject method().
public class Test {
String pwd1 ;
public static void main(String arg[]) throws IOException, ClassNotFoundException{
FileInputStream fis = new FileInputStream("//vhub.lmera.ericsson.se//home//xsinkus//WDP//Desktop2k8R2//COMP_DOCS//Test//kusha1.ser");
@SuppressWarnings("resource")
ObjectInputStream ois = new ObjectInputStream(fis);
System.out.println("I am being called ");
SerilizationTest si = (SerilizationTest)ois.readObject();
System.out.println("After called ");
System.out.println(si.name);
System.out.println(si.pwd);
//si.readObject();
}
private void readObject(ObjectInputStream ois)
throws IOException, ClassNotFoundException {
ois.defaultReadObject();
pwd1 = (String) ois.readObject();
System.out.println("I am in ");
}
}