How are we suppose to fix the deprecated methods? I just changed the constructors, that's should be enough right? Or we should do something different? One specific question: what kind of encoding we should use, if we need it at all?
Jerry Pulley
Ranch Hand
Joined: Sep 19, 2000
Posts: 221
posted
0
Adrian, I didn't see any deprecated methods in the c'tors, but maybe my assignment differs from yours. Did you compile with the <code>-deprecated</code> switch? Also, my instructions said nothing about the encoding to use, so I stuck with the default. Jerry
Adrian Yan
Ranch Hand
Joined: Oct 02, 2000
Posts: 688
posted
0
My assignment requires the change of the deprecated methods. I basically change some methods and constructors. As far as encoding, I'm sticking with default, I just want to make sure that it's the right way.
srilatha malip
Greenhorn
Joined: Feb 08, 2001
Posts: 21
posted
0
I am planning to subclass the given data classes, instead of changing the class itself. In case of changing the deprecated methods, is there any other way instead of replacing the method it self. Since, I don't want to make changes in the data class. Thanks in Advance, Srilatha.
joey phillip
Ranch Hand
Joined: Jan 22, 2001
Posts: 40
posted
0
can any one explain me how to handle the deprecated String Constructor. how to set the character encoder? joey
Paul Smiley
Ranch Hand
Joined: Jun 02, 2000
Posts: 244
posted
0
You're just dealing with ascii text, so it doesn't matter if you use 8859_1 or whatever. I'm certain that the default will be fine. There is definitely a deprecation in a c'tor but in a standard JDK class, not a suncertify one - I only got 2 overall. Use the -deprecation switch as discussed. [This message has been edited by Paul Smiley (edited March 15, 2001).]
Dilip kumar
Ranch Hand
Joined: Oct 16, 2000
Posts: 360
posted
0
My assignment requires the change of the deprecated methods. I need to modify readRecord and writeRecord methods.
joey phillip
Ranch Hand
Joined: Jan 22, 2001
Posts: 40
posted
0
paul/Dilip, I modified with String(byte[] bytes, int offset, int length) in readRecord method and it works fine. But I don't know which method and how to use for getBytes method in write record method. If anyone help me i will really appreciate. joey PS whe i try to change with byte[] getBytes() then strange boxes appear in GUI combo box.
Paul Smiley
Ranch Hand
Joined: Jun 02, 2000
Posts: 244
posted
0
You'll want to use one of the other getBytes() methods - see the API. Hint, you may need to copy the arrays and build your result from there The boxes on your GUI are nulls - you will need to trim() your strings at some point.
Anil Sadineni
Greenhorn
Joined: Feb 06, 2001
Posts: 20
posted
0
Hi Friends, I modified 1 methos with String(byte[] bytes, int offset, int length) in readRecord() method, and i used getChars() insted of using getBytes() Method. After getting the char[] from the method, I am translating the char[] to byte[](byte buffer[]). Is there anything wrong with my solution Please give me the clarification for that. Thank you Bye Anil.
michael huang
Ranch Hand
Joined: Jul 30, 2000
Posts: 63
posted
0
Hi, according to scjd spec, you should document different solution, and show benefit and weakness, so, friends, tell us your solution. i have think on it michael
michael huang
Ranch Hand
Joined: Jul 30, 2000
Posts: 63
posted
0
hi anil, can you explain how you translate char[] to byte[], by the way, i think if you can correctly change char[] to byte[], you solution is ok. michael
Latha Ganesan
Greenhorn
Joined: Feb 27, 2001
Posts: 12
posted
0
Hi!, I have done what Paul Smiley has told, I used getBytes() and copied from temp to buffer(taking care of correct length). Unlike C/C++, Java doesnot have null terminated strings. Latha
michael huang
Ranch Hand
Joined: Jul 30, 2000
Posts: 63
posted
0
yes, i think the critical is buffer length
ruilin yang
Ranch Hand
Joined: Feb 25, 2001
Posts: 334
posted
0
Since you are not dealing with International language the standard encoding: ISO8859-1 is fine.
Alex Zhang
Ranch Hand
Joined: Apr 19, 2001
Posts: 68
posted
0
I don't know really I am right to have this idea or not I have a hashtable which use the key of the record for the hashtable key and I use this record key(String) for the lock to apply synchronization within the lock method I just think if I lock the record no one can use this record concurrently and I start my modify method with no fear of other modifying the same record So I have not used the synchronized key word or synchronize block throughout the modify method Would anyone tell me if there is any problem and error with this and how to do it better?