Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

help needed -> 2 byte flag for URLybird records

 
Sundeep Nanua
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

Got the URLyBird project. I have a question. Th instructions say something of this sort regarding the data file format(for every start of the data section of the file):

"2 byte flag. 00 implies valid record, 0x8000 implies deleted record"

I tried reading each record supplied by Sun and I get a double space character for this field for every record. Does this mean that the DB file given by Sun needs to be 'post-filled' with either '00' or '0x8000'?(If yes, then what about this statement in the assignment: 'Note that you must keep a copy of the original database file supplied to you, and this must be the file you submit'!!) Or am I missing something during the read part?

I read the file using a format like this:
String str = new String(input, offset, length, "ISO-8859-1");

Also tried UTF-8 and US-ASCII but no good, I get the same output.....a double box like character that is decoded as space.

Having tough times in the assignment, please help .
Thanks in advance.

Sundeep
 
Beate Schnoor
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

use the readShort()-method from RandomAccessFile to read the flag and compare the return value to the short value "0x8000".
You don't have to post-fill anything.

Beate
[ November 11, 2008: Message edited by: Beate Schnoor ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic