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 NX: Null terminated 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 "NX: Null terminated" Watch "NX: Null terminated" New topic

NX: Null terminated

Bill Robertson
Ranch Hand

Joined: Mar 21, 2003
Posts: 234
My instructions say:
All numeric values are stored in the header information use the formats of the DataInputStream and DataOutputStream classes. All text values, and all fields (which are text only), contain only 8 bit characters, null terminated if less than the maximum length for the field. The character encoding is 8 bit US ASCII.
What does "null terminated if less than the maximum lenght for the field".
Does this mean a field that is suppossed to be 64 characters in the file,
may be less and if so it has a null indicator on the end?
If so this screws up my entire process of reading in the file!!!
I read another post regarding this issue but it did not make things
clear for me.
Mark Spritzler

Joined: Feb 05, 2001
Posts: 17276

Bill null terminated does mean that no matter how long the string actually is, it still takes up the entire space alotted. Meaning if the Name is 64 characters in the data file, then 64 characters are used. This way the record is always "fixed" length.

Perfect World Programming, LLC - iOS Apps
How to Ask Questions the Smart Way FAQ
Bill Robertson
Ranch Hand

Joined: Mar 21, 2003
Posts: 234
thanks mark. I have not worked with files for a long long time.
I agree. Here's the link:
subject: NX: Null terminated
It's not a secret anymore!