Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

(B&S) Data File Question

 
Phil Kurian
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Barry Gaunt
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Phil Kurian
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks,

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

cheers
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic