• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

URLyBird db file

 
Marcelo Ortega
Ranch Hand
Posts: 528
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • 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.
 
Tom Henricksen
Author
Ranch Hand
Posts: 144
5
Eclipse IDE jQuery Spring
  • Mark post as helpful
  • send pies
  • 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
 
Robert Aragon
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • 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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic