File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes B&S 2.2.1 Data File Null Terminated Fields??? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of JavaScript Promises Essentials this week in the JavaScript forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "B&S 2.2.1 Data File Null Terminated Fields???" Watch "B&S 2.2.1 Data File Null Terminated Fields???" New topic
Author

B&S 2.2.1 Data File Null Terminated Fields???

Chris Bicnal
Ranch Hand

Joined: Aug 17, 2005
Posts: 80
    
    1
Hi guys,

I'm doing the final read through of everything before submitting and I've noticed that the data file is described as...
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.

Now, when I look at the provided data file and read a record they've padded fields with spaces (ASCII code 32) - not nulls as they have described!

Has anyone else encountered this? If so, what approach have you taken?

Thanks,

Chris


Roberto Perillo
Bartender

Joined: Dec 28, 2007
Posts: 2267
    
    3

Howdy, Chris!

Has anyone else encountered this? If so, what approach have you taken?


Yup. And here's what I did: I kept the database format, that is, I didn't use null terminators, I used empty spaces to fill the remaining positions of each field value. For instance, if a field length in the database is 64 positions, and the provided value has 50 characters, then it will be saved with the 50 characters + (64 - 50) empty spaces.


Cheers, Bob "John Lennon" Perillo
SCJP, SCWCD, SCJD, SCBCD - Daileon: A Tool for Enabling Domain Annotations
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5514
    
  13

Hi Chris,

I did the same thing as Roberto.
And you could/should of course add something about this decision in your choices.txt

Kind regards,
Roel


SCJA, SCJP (1.4 | 5.0 | 6.0), SCJD
http://www.javaroe.be/
Jari Timonen
Ranch Hand

Joined: Jan 16, 2004
Posts: 232
I also use spaces instead of null terminators.


SCJP 5.0, SCJD URLyBird 1.3.3, OCMJEA 5 (SCEA) Factory Homes
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: B&S 2.2.1 Data File Null Terminated Fields???