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

B & S ::Magi cookie during Reading file

 
Bhavik Patel
Ranch Hand
Posts: 155
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hii guys .. i was trying develop sample test proram to read from the file with the following code...
first 4 bytes are said to be the magic cookie value(Numeric)and other header part .. It doesnt give me the proper values as i was expecting numeric value for cookie and total fields ..can anyone tell me whats wrong with the follwoing code ...

 
Jeroen T Wenting
Ranch Hand
Posts: 1847
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
They're not stored as Strings.
 
Bhavik Patel
Ranch Hand
Posts: 155
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can you please specify in more detail ..how to extract it ??
 
Barry Gaunt
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To elaborate a little: when the assignment specification mentions binary (numeric) data it means that you can read it into a variable that is a Java primitive type. You can determine that type usually by looking at the length of the field. So if the binary field is 2 bytes it must be a 16 bits Java primitive. Once you have determined the primitive type you can select from the API the appropriate methods to read and write it.
[ September 23, 2006: Message edited by: Barry Gaunt ]
 
Ken Boyd
Ranch Hand
Posts: 329
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

[ September 23, 2006: Message edited by: Ken Boyd ]
 
Barry Gaunt
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Excellent Ken, but not in the spirit of the SCJD certification somehow.
 
Ken Boyd
Ranch Hand
Posts: 329
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sorry about that..I knew I shouldn't do it but sometime people ask for everything
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic