|
|
The JDK 1.1 release added many features to make it easy for programmers to develop internationalized programs. Some changes were required to theStringclass to make it a better international citizen. In fact, all of the changes made to theStringclass are related to internationalization issues.Be careful: Some uses of the
StringandStringBufferclasses may compromise the "international quality" of your program. See Writing Global Programsfor a discussion about managing text in a global fashion.
The first column in the following table lists the constructors and methods in theStringclass that are deprecated in the JDK 1.1. The second column lists alternatives for those constructors and methods:
These constructors and methods were deprecated because they did not properly convert bytes into characters. The new constructors and methods use a named character-encoding or the default character-encoding to do the conversion.
Deprecated Methods Alternatives String(byte[], int)String(byte[]) or String(byte[], String)String(byte[], int, int, int)String(byte[], int, int) or String(byte[], int, int, String)getBytes(int, int, byte[], int)byte[] getBytes(String)orbyte[] getBytes()New Methods
These constructors and methods were added to theStringclass for the JDK 1.1.The four new constructors and the two newString(byte[]) String(byte[], int, int) String(byte[], String) String(byte[], int, int, String) byte[] getBytes(String) byte[] getBytes() String toLowerCase(Locale) String toUpperCase(Locale)getBytesmethods are described in the previous section. The other two methods,toLowerCaseandtoUpperCaseconvert theStringto lower or upper case according to the rules in the specifiedLocale. For information about
Locales and writing internationalized programs, see the new lesson Writing Global Programs.
|
|