• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

URLyBird db file

 
Ranch Hand
Posts: 528
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I understand now that a Magic Cookie is found in the header of the db file (in my case URLyBird 1.2.1 db) and is a int value which must be retrieved from at first to be compared with in the futer to make sure we are talking about the same db file, else exceptuion is thrown. Ok.

I have retrieved my Magic cookie number and have put it in a constant variable for futher testing.

First question: why is it that when i try read ALL of the contents of the file (using RandomAccessFile) i get all question marks and crosses, even when i cast the return ints to char?
Also, when i open the file using word or open office, i find that it contains many un readable chars (small squares). Is it not in unicode formatting?

Thanks in advance and regards.
 
Author
Posts: 144
5
jQuery Eclipse IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why don't you post a snippet of your code that is having the problem and we can try and help you out.
Thanks,
Tom
 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The db file is a binary file. You need to walk around inside the file,
seeking the different areas where the records start and end.

RandomAccessFile raf = new RandomAccessFile("dbfilename.db");
long fileOffSet;
byte byteBuf

Try this:
fileOffSet = 76; // If 76 does not work, change it. Look at your assignment
// description.
in.seek(fileOffSet);
in.readFully(byteBuf);
name = new String(byteBuf);
System.out.println(name);

Try different values
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic