Hi ..
I have a problem in Java hashtable serialization that seems illogical to me but i am not able to find out the error in the logic i am using. Here is what i am doing,
Hashtable sspsrpData = new Hashtable();
for(int i=0;i<Constants.secondayStructures.length;i++) {
SecondaryStructures ss = (SecondaryStructures)(data.get(Constants.secondayStructures[i]));
sspsrpData.put(Constants.secondayStructures[i], new SecStrucPSRP(ss.getSecStruct(),ss.getLengthCounts()));
}
FileOutputStream fos = null;
ObjectOutputStream out = null;
fos = new FileOutputStream(Constants.sspsrpData);
out = new ObjectOutputStream(fos);
out.writeObject(sspsrpData);
This piece of code should put 3 key-value pairs in the hashtable and also should serialize the thus formed hashtable. Now when i am trying to retrive them back in another program by this piece of code:
FileInputStream fis = null;
ObjectInputStream in = null;
fis = new FileInputStream(Constants.sspsrpData);
in = new ObjectInputStream(fis);
ssPsrp = (Hashtable)in.readObject();
The resulting hashtable has only 2 key-value pairs. Though the count in the hashtable says 3 i can only see 2 key value pairs in the hashtable. I do not understand whats going wrong!!
Can somebody point out where am i going wrong?
Thanks and Good day, Santhosh