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 (B&S) Data File Question 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 "(B&S) Data File Question" Watch "(B&S) Data File Question" New topic

(B&S) Data File Question

Phil Kurian
Ranch Hand

Joined: Feb 26, 2006
Posts: 35
Hi All,

Not sure if it's just my naivity (stupidity or whatever) but I am having a bit of a drama reading the database file provided.

I attempted to browse through it using a text editor so I could get an idea of the format. However wordpad and notepad fails to recognise a lot of the characters - particularly in the header. I had similar problems when I tried viewing it in vi on linux. (e.g. first line of header looks something like this:

^@^@^B^B^@^@^@F^@^Dname etc)

Is this normal? Will it make more sense when a java program reads the bytes in? Do I need to change the character encoding or something... or do I have a corrupted file?

SCJP (1.4)
Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
In your instructions, you should have a section describing the data file format. Where it uses the terminology: 4 byte numeric, for example, that is where the file contains binary data and not ASCII text. You have to choose classes from the java io packages which have the appropriate methods available to read from and write to the file in binary format.

In fact, if you read the data file format section in detail it possibly tells you what classes use the the format.

Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
Phil Kurian
Ranch Hand

Joined: Feb 26, 2006
Posts: 35

I actually tried reading the bytes in one by one and it all made sense.

I agree. Here's the link:
subject: (B&S) Data File Question
It's not a secret anymore!