wood burning stoves 2.0*
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


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

(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
Thanks,

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

cheers
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: (B&S) Data File Question
 
Similar Threads
how to ignore whitespace in xml
How to use VB .dll in java
html header
Need help Read the File and replace its Header contents
making a download servlet to service download managers