• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

Deprecated methods

 
Ranch Hand
Posts: 688
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Ranch Hand
Posts: 221
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 688
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can any one explain me how to handle the deprecated String Constructor.
how to set the character encoder?
joey
 
Ranch Hand
Posts: 245
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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).]
 
Ranch Hand
Posts: 360
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My assignment requires the change of the deprecated methods. I need to modify readRecord and writeRecord methods.
 
joey phillip
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 245
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes, i think the critical is buffer length
 
Ranch Hand
Posts: 334
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Since you are not dealing with International language the standard encoding: ISO8859-1 is fine.
 
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
The glass is neither half full or half empty. It is too big. But this tiny ad is just right:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic