Start of file
4 byte numeric, magic cookie value. Identifies this as a data file
4 byte numeric, total overall length in bytes of each record
2 byte numeric, number of fields in each record
Schema description section.
Repeated for each field in a record:
2 byte numeric, length in bytes of field name
n bytes (defined by previous entry), field name
2 byte numeric, field length in bytes
end of repeating block
Repeat to end of file:
1 byte "deleted" flag. 0 implies valid record, 1 implies deleted record
Record containing fields in order specified in schema section, no separators between fields, each field fixed length at maximum specified in schema information
End of file
Also the UB system has intent to move the system to web, which means the data file can become relational database table(s). Does anyone think about using the data "as if it were relational database"?
If the data row is read like an object (relational DB sense), how easy is it to turn the row's object toString() method to a String array for the read() method? I'm thinking once I have the toString() method output say a Hotel object with name and location (format name,location), I split that up using the comma and store into array. But would this be too much work?
Thanks Jeffrey and satishkumar. Now I got this problem/query: since the data is read as bytes, and I'm using RandomAccessFile to read the file, how can I read characters or strings so that it output ASCII? Currently I'm using readBtye() for everything. Hence my field name display a series of number instead of the actual name in English.
magic cookie value = 0011
Originally posted by Jeffry Kristianto Yanuar:
The magic cookie is 4 bytes. remember from the basic programming language, 4 bytes is integer right, you can use the randomAccessFile's readInteger() method to read it. Try to read the two bytes using readShort() method. 2 bytes means it is a short.
Good Luck !!!
Jeffry Kristianto Yanuar (Java Instructor)
SCJP 5.0, SCJA, SCJD (UrlyBird 1.3.2)