I just wanted to make sure i did this correct, but
i dont think i have. Could you please let me know what
i have dont wrong.
Here is my code:
*******************************************************
public static void clntWrite(Vector clntData) throws
FileNotFoundException, IOException
{
DataOutputStream dos = new DataOutputStream(new
BufferedOutputStream(new
FileOutputStream("clnt.dat")));
try
{
for (int i = 0; i< clntData.size(); ++i)
{
Client aClient = (Client)clntData.elementAt(i);
dos.writeInt(aClient.getAccNo());
dos.writeUTF(aClient.getSurname());
dos.writeUTF(aClient.getFirstName());
dos.writeUTF(aClient.getAge());
//dos.writeInt(aClient.getAccDetails());
}//end for loop
dos.flush();
dos.close();
System.out.println("Client information saved...");
}//end try
catch (Exception e)
{
System.out.println("Unable to save account information
to client.dat" );
System.out.println("Error: " + e.getMessage());
}
}//end clntWrite method
public static Vector clntRead(Vector clntData) throws
FileNotFoundException, IOException
{
DataInputStream dis = new DataInputStream(new
BufferedInputStream(new FileInputStream("clnt.dat")));
while (dis.available()>0)
{
Client aClient = new Client();
aClient.setAccNo(dis.readInt());
aCustomer.setSurname(dis.readUTF());
aCustomer.setFirstName(dis.readUTF());
aCustomer.setAge(dis.readUTF());
//aCustomer.setAccDetails(dis.readInt());
clntData.addElement(aClient);
}//end while
dis.close();
return clntData;
}//end clntRead method