File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes null terminated text fields? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "null terminated text fields?" Watch "null terminated text fields?" New topic

null terminated text fields?

Henry Zheng
Ranch Hand

Joined: Jan 24, 2004
Posts: 60

I'm currently working with my assignment, and I got a problem regarding to the format of the text fields in the db file.

My assignment mandates all text fields be "null terminated if less than the maximum length for the field"(directly quoted from instructions).

But when I checked the original db file comes along with the assignment, I found that text fields are padded by spaces.

So should I pad the empty bytes with 0 or with white spaces? And do I need to consider the whitespace padding in the original records part of the fields(which is not sensible) or just rip them off?


Henry Zheng<br /> <br />I went numb when I learned to see.
Omar Kalaldeh
Ranch Hand

Joined: Jun 08, 2004
Posts: 58
Hi Henry,

I think the following link will help you,
URLyBird 1.3.3 data file: Reply from SUN

Padding strings with white spaces is completely accepted by sun, and it is the easiest way.

Best Regards <br /> <br />Omar F. Kalaldah<br />---------------------<br />SCJP, SCJD, SCBCD
I agree. Here's the link:
subject: null terminated text fields?
It's not a secret anymore!