• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

NX: Do we need to return the deletedFlag in readRecord method?

 
Ranch Hand
Posts: 697
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all, I got a sort of dumb doubt.
In the readRecord method, that is provied by Sun it says to return the record as follows.

Should we also return the 1 byte deleted flag that is present before each record? Obviously the flag is 0 as the record exists. So, do we need to return this in the String []?
Also the comment above method says "Reads a record from the file. Returns an array where each element is a record value." Here record value is field value right? like name, location and so on...of one record with given recNo.
Appreaciate your help, thanks.
[ February 19, 2004: Message edited by: Satish Avadhanam ]
 
Ranch Hand
Posts: 619
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Satish,

Originally posted by Satish Avadhanam:
Should we also return the 1 byte deleted flag that is present before each record? Obviously the flag is 0 as the record exists. So, do we need to return this in the String []?


No, yes, and no.
There are two cases to consider for a record. Either
1) the record is marked as deleted
2) the record is valid (not marked as deleted)
If 1, then you're throwing the RecordNotFoundException, right?
If 2, then you're returning a record in String[]. The fact that you return a record and did not throw the RecordNotFoundException indicates that the record must have been valid. It's never valid to read a record that is marked for deletion (that is, a non-valid record), is it?
 
Satish Avadhanam
Ranch Hand
Posts: 697
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by George Marinkovich:
Hi Satish,
No, yes, and no.
There are two cases to consider for a record. Either
1) the record is marked as deleted
2) the record is valid (not marked as deleted)
If 1, then you're throwing the RecordNotFoundException, right?
Yes, obviously. That's what is one of the MUST requirements by Sun.

If 2, then you're returning a record in String[]. The fact that you return a record and did not throw the RecordNotFoundException indicates that the record must have been valid. It's never valid to read a record that is marked for deletion (that is, a non-valid record), is it?
Yes George. I think its upto us right. I mean deleted flag does not include as part of a record, it says whether a record is present or not. So if we document about our idea, then that's ok, I think.


Appreciate your help, thanks.
[ February 19, 2004: Message edited by: Satish Avadhanam ]
 
Bartender
Posts: 1872
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Satish,

So, do we need to return this in the String []?


No (because the deleted flag is not a field).
Regards,
Phil.
 
Satish Avadhanam
Ranch Hand
Posts: 697
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Phil. I will not return the deleted flag.
When I first replied it, I guess, I forgot to say "not". I have been working for 2 days continously and was and Anyway, thanks Phil.
[ February 23, 2004: Message edited by: Satish Avadhanam ]
[ February 23, 2004: Message edited by: Satish Avadhanam ]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic