Hi, thanks for your response.
I have check the position of the pointer and it is correct. Because the name of the first field is "name", so I try to read four bytes in sequence (e.g. using readByte()) instead of using readUTF() for debuging, it gives 110,97,109 and 101 which is the field name "name". So that the data file is not corrupted.
It seems that the program try to read the unicode from the data file but the character encoding of the file is 8 bits US ASCII. Is it I need to set the Charset to "US-ASCII" before using readUTF ?
Nevertheless, I use the FileChannal to retrieve the database scheme and it is successfully. Thanks for your help.
I also have two new problems
1. If I have two synchronized methods in the class Data, e.g.
public synchronized String[] read(int recNo) throws RecordNotFoundException
public synchronized void update(int recNo, String[] data) throws RecordNotFoundException
Is it only one method is executed at the same time. E.g. One
thread execute the read method, another thread will wait if it want to execute the update method ?
2. Accord to the Assignment, the delete method is only mark the record flag to "0xFF", and the create method will reuse the deleted record. Is it means that before I create the new record in database, I need to check that if there has the deleted record and reuse it, if there has no deleted record in database, then I need to create the new record.
Thanks
[ July 21, 2003: Message edited by: kwwong wong ]