• 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

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

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Bartender
Posts: 1872
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Philippe. That's just what I needed to move forward.
[ July 25, 2003: Message edited by: Mark Gentzel ]
 
reply
    Bookmark Topic Watch Topic
  • New Topic