File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes URLyBird Data File Format 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 "URLyBird Data File Format" Watch "URLyBird Data File Format" New topic
Author

URLyBird Data File Format

Ramya Ramalingam
Greenhorn

Joined: Sep 20, 2010
Posts: 13
Hi,
Greetings everybody!I am new to this forum.
As I was trying to use Roberto Perillo's file reader,I found the Record length is missing in my assignment...
Can anybody help me,how to change the code to my use?

And also I dont understand "n bytes,field name" in the following description(of my assignment) .

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


Thanks,
Ramya.
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5201
    
  12

We can't guess who your assignment looks like, so you'll have to post the database structure (schema) of your assignment.


SCJA, SCJP (1.4 | 5.0 | 6.0), SCJD
http://www.javaroe.be/
Ramya Ramalingam
Greenhorn

Joined: Sep 20, 2010
Posts: 13
Thank you for replying.I think you are asking for this,

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.


Thanks,
Ramya.
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5201
    
  12

Did you look at the "Data file Format" section? That's the place where my assignment mentions the number of bytes of the magic cookie, length of each record,...
Ramya Ramalingam
Greenhorn

Joined: Sep 20, 2010
Posts: 13
oh!I posted that in my question,but i gave only half information...

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


Thanks,
Ramya.
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5201
    
  12

Did you already tried putting everything with regard to the record length (which you don't have) in comments and just running the tool?
Ramya Ramalingam
Greenhorn

Joined: Sep 20, 2010
Posts: 13
Hi Roel,

I will get back to you soon.



Thanks,
Ramya.
Ramya Ramalingam
Greenhorn

Joined: Sep 20, 2010
Posts: 13
Hi Roel,

Sorry,I couldn't get back soon.This is what i did,
1.I commented out all Record length,it works fine.It displayed magic cookie value and all the record values.

2.I set record length value=0; still it works fine.

3.I didn't change anything and run the code as it is,it only displayed like this:


C:\Users\Ramya\Desktop>java DBFileReader
Magic cookie: 259
Record length: 459886
Number of fields in each record: 24941


So it looks like i dont need record length for my assignment


Thanks,
Ramya.
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5201
    
  12

Hi Ramya,

There are different versions of assignment: different interfaces to implement, different database file structures,... So it could be your assignment doesn't have a record length in the database file. If everybody had the same assignment, you could easily copy the code from a friend of yours who passed already the SCJD certification. With different assignments it will be a lot harder.

Kind regards,
Roel
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: URLyBird Data File Format