Core Java With OCJP/SCJP-Serialization-Part 9

preview_player
Показать описание
DURGASOFT is INDIA's No.1 Software Training Center offers
online training on various technologies like JAVA, .NET ,
ANDROID,HADOOP,TESTING TOOLS , ADF, INFORMATICA, SAP...
courses from Hyderabad & Bangalore -India with Real Time Experts.
so that our Supporting Team will arrange Demo Sessions.
Ph:Call +91-8885252627,+91-7207212428,+91-7207212427,+91-8096969696.
Рекомендации по теме
Комментарии
Автор

Good work, explaining everything in detail.

tommystephen
Автор

Hi Sir,
Thank you for your wonderful training. I have one doubt.forgive me if its basic question

while doing customization, JVM will search for writeObject method in Serialization and readObject in Deserialization right .
1. Since Serializable interface is marker interface, on what basis JVM will search these methods
2.where do these 2 methods present? I mean in which class?

Please help me with your valuable answer

chakrimuvvala
Автор

sir great tutorial I loved it
sir can you please provide all the notes and all that programmes....
Than yoy

gauravkumar-hrbe
Автор

Why do we have to use os.writeObject(epwd)

gavravdhongadi
Автор

hi sir, I have one doubt. writeObject method takes the parameter of ObjectOutputStream. But in this case we are calling the method by passing Account object (OOS.writeObject (acc)) . how it's working sir? please explain

rajasekar
Автор

If I have more then one String and more then one transient variable in the class then, how my readObject() and readInt() method identify from file which value belongs to which variable.There is anyway to differentiate because conflict will be there .How I can resolve it.

chiragshah
Автор

The way you teaches nothing would be difficult. So, there is no chance of difficulties in whole java

sanjeevkumar-jeyt
Автор

import java.io.*;

public class Account implements Serializable{
String username = "Prasad";
transient String pwd = "Vishnu";

private void readObject(ObjectInputStream ois) throws Exception{
ois.defaultReadObject();
String epwd = (String) ois.readObject();
pwd = epwd.substring(6);
}

private void oos) throws Exception{
oos.defaultWriteObject();
String epwd = "Matha "+pwd;
oos.writeObject(epwd);
}

public static void main (String[] args) throws Exception {
Account a = new Account();
FileOutputStream fos = new
ObjectOutputStream oos = new ObjectOutputStream(fos);
oos.writeObject(a);

FileInputStream fis = new
ObjectInputStream ois = new ObjectInputStream(fis);
Account a2 = (Account) ois.readObject();
//"Prasad"
System.out.println(a2.pwd); //"Vishnu"
}
}

prasad