Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

NX: URLyBird 1.2.2: db-1x2.db database file question

 
Mark Gentzel
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is a question about the nature of the database file in this assignment. I'm hoping that somemone can point me in the right direction - my background is more web-application-centric and I'm a bit green in the IO department.
I just started reviewing my assignment while working through Max's book and found myself somewhat perplexed by this file (I was a bit surprised that the database itself didn't have just a wee bit more documentation about it's creation).
Question 1: I'm wondering if this file represents a serialized object that contains all DB records in a single file, or some other kind of binary file that contains text formatted data?
Question 2: Is there a standard way that I can determine whether this file is a serialized object or other type of file (some type of file-type test that Java uses)?
Question 3: In any case, could someone point me to the right starting point in the Java IO package for investigating this file and working with it(I assume this is where I would find the tools)?
In Max's book, the version 1 database uses multiple files, each representing individual DVD titles, which are serialized objects, and the code that retrieves and works with them reads the individual files and puts them into a single data structure. So, I'm wondering if I need to work with this file in a similar way - except that it will represent all records in a single file.
So far, this is the only thing that is really a sticking point for me.
Thanks in advanced for any insight.
 
Philippe Maquet
Bartender
Posts: 1872
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Mark,

Question 1: I'm wondering if this file represents a serialized object that contains all DB records in a single file, or some other kind of binary file that contains text formatted data?

It's a binary file.

Question 2: Is there a standard way that I can determine whether this file is a serialized object or other type of file (some type of file-type test that Java uses)?

Normally, the file format is described in your instructions.

Question 3: In any case, could someone point me to the right starting point in the Java IO package for investigating this file and working with it(I assume this is where I would find the tools)?

To read the file header, I use RandomAccessFile.
After that, I get a FileChannel from it and use it to read/write records using NIO. If you have a look to ByteBuffer and Charset classes too, you should find your way IMO.
Best,
Phil.
 
Mark Gentzel
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Philippe. That's just what I needed to move forward.
[ July 25, 2003: Message edited by: Mark Gentzel ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic