Hi,
I am trying to read object of perticular type into a data structure from a file. I have written objects into this file earlier. Below is the code I am using to write to file

public void CreateOrg(Organisation creatingOrg)

{

FileOutputStream fileOut,fileOut2;
ObjectOutputStream objOutStrm,objOutstrm2;
//FileInputStream fileIn;
//ObjectInputStream oInStrm;

try
{
fileOut = new FileOutputStream(creatingOrg.name+".org");
objOutStrm= new ObjectOutputStream(fileOut);
objOutStrm.writeObject(creatingOrg);
objOutStrm.flush();
objOutStrm.close();
// file containing list of available organisation
fileOut2= new FileOutputStream("Orglist.lekha",true);
objOutstrm2= new ObjectOutputStream(fileOut2);
objOutstrm2.writeObject(creatingOrg);
objOutstrm2.flush();
objOutstrm2.close();

}
catch(Exception e)
{
System.out.println("I/O ERROR");
}

}

here creatingOrg is a object of type Organisation class and this class is serializable.

and else where I am trying to read from the file "Orglist.lekha". Below is the code I am using to read back the objects

void loadOrgList()

{
String currOrg;
FileInputStream inFile;
ObjectInputStream inObj;
boolean flag=false;
Organisation temp= new Organisation();
try
{
inFile= new FileInputStream("Orglist.lekha");
inObj= new ObjectInputStream(inFile);
while(!flag)
{
System.out.println("Inside While");
System.out.println(flag);
try{
temp= (Organisation)inObj.readObject();
System.out.println(temp.name);
}
catch(EOFException eof){System.out.println(eof); flag=true;}

}
}
catch(Exception e){ System.out.println(e);}

//catch(ClassNotFoundException clss){System.out.println(clss);}
}

Now my problem is that when I try to read objects continously, I am able to read only the first written object. While writing "Orglist.lekha" append= true. so even if I have written more than one object I am not able to read it back. I am getting following error in my second run of the while() loop. Please help me with this because I am stuck here and my work is not proceeding.

Thank you and greatful any one how cares to read this
bye