This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes DB file -Data section. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "DB file -Data section." Watch "DB file -Data section." New topic
Author

DB file -Data section.

James Clinton
Ranch Hand

Joined: Jun 23, 2003
Posts: 190
My assignment states UrlBird.
Data section.
Repeat to end of file:
1 byte "deleted" flag. 0 implies valid record, 1 implies deleted record


When I read the field the byte is BLANK! do I need to set this to 0?

here is my code to read in that 1 byte.


Output



Thanks!
Anton Golovin
Ranch Hand

Joined: Jul 02, 2004
Posts: 476
Hi, James. I used the following code to read in a record:


[ November 11, 2004: Message edited by: Anton Golovin ]

Anton Golovin (anton.golovin@gmail.com) SCJP, SCJD, SCBCD, SCWCD, OCEJWSD, SCEA/OCMJEA [JEE certs from Sun/Oracle]
jiju ka
Ranch Hand

Joined: Oct 12, 2004
Posts: 306
Prior to reading the complete record checking whether the record is already deleted or not is better.

If the flag is not valid you don't have to set it to the right one( if the requirement is not saying so). In my asignment flag can be changed during insert or delete.
James Clinton
Ranch Hand

Joined: Jun 23, 2003
Posts: 190
Anton
ASCII-US doesn't work. Are you sure its not US-ASCII ?


 
It is sorta covered in the JavaRanch Style Guide.
 
subject: DB file -Data section.
 
Similar Threads
Version 2.1.2 Bodgitt and Scarper
Database file wrong, what should I do ?
NX:URLyBird About "deleted" flag
NX: Please Help - Writting and Reading 2 byte flag
deleted flag for Contractor object