Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Magic cookie and deleted record flag

 
Payal Shah
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
UrlyBird(1.2.3)

1) Magic Cookie:
I am hardcoding the magic cookie value to 259 since the give data file has that value. Everytime I read the header file, I am checking that cook is 259. If the value is not 259, I throw new IOException().
Is that right?

2) 1 byte flag. 00 implies valid record, 0xFF implies deleted record.
When I read the file, that field has 0 value not 00.
what is 0xFF? Is it a hexadecimal number? Am a storing hex when the record gets deleted.
Right now, I have flag as type byte in my data object. I am not sure if I just make this field string and store "0xff" as a string value.

Thank you.
 
Jeffry Kristianto Yanuar
Ranch Hand
Posts: 759
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For number 1, you are correct. Magic cookie is for determining that the file is the correct file.

For number 2, if you want to know the value of 0xFF, just use the System.out.println(0xFF). I tried in my calculator, the value is 255. You can try in your own calculator.

for each record n the database you can try this :




Remember, if you can read all the data in the database scheme, it means you already have a good start. Reading all the database scheme was my first step. I shared my experience in here : http://www.coderanch.com/t/419374/sr/certification/URLyBird-Passed

Good Luck !!!

Jeffry Kristianto Yanuar (Java Instructor)
SCJP 5.0, SCJA, SCJD (UrlyBird 1.3.2)
 
Payal Shah
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you :-)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic