The JDK 1.1 release added many features to make it easy for programmers to develop internationalized programs. Some changes were required to the
Stringclass to make it a better international citizen. In fact, all of the changes made to the
Stringclass are related to internationalization issues.
Be careful: Some uses of the
StringBufferclasses may compromise the "international quality" of your program. See Writing Global Programs for a discussion about managing text in a global fashion.
Deprecated MethodsThe first column in the following table lists the constructors and methods in the
Stringclass 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) or String(byte, String)
String(byte, int, int, int)
String(byte, int, int) or String(byte, int, int, String)
getBytes(int, int, byte, int)
New MethodsThese constructors and methods were added to the
Stringclass 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,
Stringto lower or upper case according to the rules in the specified
Locale. For information about
Locales and writing internationalized programs, see the new lesson Writing Global Programs.