File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes How to start with Data File - URLyBird 1.3.3 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "How to start with Data File - URLyBird 1.3.3" Watch "How to start with Data File - URLyBird 1.3.3" New topic

How to start with Data File - URLyBird 1.3.3

Kedarnath Bhagwat

Joined: Oct 27, 2009
Posts: 20
Can somebody help me on how to start based on the following description

Data file Format
The format of data in the database file is as follows:
Start of file
4 byte numeric, magic cookie value. Identifies this as a data file
2 byte numeric, number of fields in each record

Schema description section.
Repeated for each field in a record:
1 byte numeric, length in bytes of field name
n bytes (defined by previous entry), field name
1 byte numeric, field length in bytes
end of repeating block

Data section.
Repeat to end of file:
1 byte flag. 00 implies valid record, 0xFF implies deleted record
Record containing fields in order specified in schema section, no separators between fields, each field fixed length at maximum specified in schema information

End of file

All numeric values are stored in the header information use the formats of the DataInputStream and DataOutputStream classes. All text values, and all fields (which are text only), contain only 8 bit characters, null terminated if less than the maximum length for the field. The character encoding is 8 bit US ASCII.

Database schema
The database that URLyBird uses contains the following fields: Field descriptive name Database field name Field length Detailed description
Hotel Name name 64 The name of the hotel this vacancy record relates to
City location 64 The location of this hotel
Maximum occupancy of this room size 4 The maximum number of people permitted in this room, not including infants
Is the room smoking or non-smoking smoking 1 Flag indicating if smoking is permitted. Valid values are "Y" indicating a smoking room, and "N" indicating a non-smoking room
Price per night rate 8 Charge per night for the room. This field includes the currency symbol
Date available date 10 The single night to which this record relates, format is yyyy/mm/dd.
Customer holding this record owner 8 The id value (an 8 digit number) of the customer who has booked this. Note that for this application, you should assume that customers and CSRs know their customer ids. The system you are writing does not interact with these numbers, rather it simply records them. If this field is all blanks, the record is available for sale.

kmbhagwat , SCJP 6
Roel De Nijs

Joined: Jul 19, 2004
Posts: 8403

Hi Kedarnath,

Use Roberto Perillo's Database File Reader tool, a link to this great tool (and starting point) can be found in ScjdFaq.

Kind regards,

SCJA, SCJP (1.4 | 5.0 | 6.0), SCJD
I agree. Here's the link:
subject: How to start with Data File - URLyBird 1.3.3
It's not a secret anymore!