I was wondering could somebody help me out or point me in the right direction. I've just started the SCJD. I was able to extract the first 3 values from the .db file but when I looked at the layout of the information in the .db file it appears as shown below(a partial screen dump from command prompt),
----------------------------------------------------- The different symbols stand for the 2 byte numerics wrapping the field names but it appears that the numerics are missing from after the 'name' field and before the 'location' field. Is this a problem with ht efile sent to me by SUN or should those valuse not be there. Any help is really appreciated. thanks.
Bert, Aah....That name sounds too familiar!... Welcome to the ranch and to the forum!(at last I get the lucky chance to welcome somebody in this forum )
The db file is a binary file, so it is different. It also contains a lot of non-printable ascii characters.You could use a Hex editor to read the data or write a small program to read the file contents. As Laura suggested, use Java IO API to read/write the file contents. I am using RandomAccessFile for my assignment.You should also go thru your Data File Format section in your instructions document.That explains the data schema of the supplied database file.
I was using readShort and readInt to get the first values and they worked fine. But then when I printed out the file values in DOS there were a few missing but then I used the Hex editor and they seem to be there alright. cheers for the help.
i think the numerics in the db file are confusing. if i remember correctly, some of them are genuinely numbers in hex form, and some of them go via a text format.
eg, the length of a field is a hex number, and needs to be read as such. however the capacity of a room is a text number, so needs to be read as an int, and then cast as a char, or something like that.
i could be wrong though ...
Every plan is a little cooler if you have a blimp. And a tiny ad.
Free, earth friendly heat - from the CodeRanch trailboss