• 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
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

NX:[URLyBird]Small case about numeric type

 
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,all
In my assignment URLyBird,there is a paragraph description following:


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.


1 byte flag. 00 implies valid record, 0xFF implies deleted record
According to the BOLD statement:
1)What numeric type and name can I use to assign the flag "valid" or "deleted"?
2)The state said,All numeric values are stored in the header information use the formats of the DataInputStream and DataOutputStream classes.
Must I write a class called Header to store all the data description?And how to invoke the seperated class Header.java?
Thanks in advance,
Richard,
Jul 11,2003
 
Ranch Hand
Posts: 442
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

1)What numeric type and name can I use to assign the flag "valid" or "deleted"?


byte will do, as for name, do you mean name of the variable, sorry, I dont think I understand that.

2)The state said,All numeric values are stored in the header information use the formats of the DataInputStream and DataOutputStream classes.
Must I write a class called Header to store all the data description?And how to invoke the seperated class Header.java?


sounds reasonable, but maybe I'm biased to my own implementation, anyhat, my Header instance is a private member of my Data class.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As my idea,the difficulty is to specify some variables and numeric type for the file header,e.g. magic cookie.
And then,you should organize other useful things
and collect information into header information file.
You are free to name them,at the same time,I believe some other professinals will help you.
Good luck!
Regards,
Tom,Jul 2003
 
Put a gun against his head, pulled my trigger, now he's dead, that tiny ad sure bled
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic