Originally posted by Venkateswara Rao Gunturu:
All text values, and fields(which are text only), contain only 8 bit chatacters,
null terminated if less than the maximum length for the field.
The character encoding is 8 bit US ASCII.
I could not get what "null terminated if less than the maximum length for the field" means.
[ April 18, 2003: Message edited by: Venkateswara Rao Gunturu ]
Java Encoding Schemes
US-ASCII
US-ASCII is a 7-bit encoding scheme that covers the English-language alphabet. It is not large enough to cover the characters used in other languages, however, so it is not very useful for internationalization.
Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
Originally posted by Barry Gaunt:
The null character is C char 0 (a byte containing all zero bits). It is used by C/C++ programs, for instance, to terminate a string in an array of char. Now, Sun says the file has to be usable by a legacy application, and this is the first Java application, right? So you could in theory get a field of width 24 containing the bytes 'H', 'e', 'l', 'l', 'o', 0, the rest being junk. According to the assignment instuctions I have, the Java application must be able to import this data.
[ April 25, 2003: Message edited by: Barry Gaunt ]
End of file section
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.
Originally posted by Venkateswara Rao Gunturu:
Hi Ta Ri Ki Sun, and Barry Gaunt,
In the assignment, they clearly mentioned in the
What I feel is java implementation of String also ends with char 0.
In my assignment, last field of the record is 8 digit number. That means it is text only. I am reading all the values of the record as Strings only. Initially I read the record in the byte array, and constructing String object, and then takingout the fields according to their field length.
Here I have a doubt. Whether I am right or going out of track. Please correct me. While creating new record, I am padding with empty spaces to fill the maximum field length.
GVRao
Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
EG 1
'H', 'e', 'l', 'l', 'o', ' ', ' ', ' ', ' ', ' '
or we can have
EG 2
'H', 'e', 'l', 'l', 'o', 0, '?', '*', '8', 'f'
Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
Originally posted by Barry Gaunt:
That's right TQ, in the sample db-2x2.db file the records are padded with blanks as your EG 1. But the instructions imply that they may not always be. So I will allow for the null terminated possibility EG 2.
Once again, my discaimer holds.I'm not in a hurry and will be thinking about things for another month or two before I start designing.
Record containing fields in order specified in schema section, no seperators between fields, each field fixed at maximum length specified in schema information.
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime. |