Matt Gerrans
Posts: 1153
Nickname: matt
Registered: Feb, 2002
|
|
Re: Use of PrintWriter?
|
Posted: May 29, 2002 12:20 PM
|
|
Sorry, there are no pointers in Java.
...has the uproarious laughter subsided? Hmm, I guess I won't quit my day job, just yet.
Internationalization means writing code that can be easily ported to other languages simply by changing the resources. That means not hard-coding strings for menu items, buttons, and so on, but instead, reading them from resources at runtime. The set of resources chosen at runtime is based on the current locale settings of the machine (that is, the region and language settings).
Many languages have double-byte character sets, so they cannot be represented by single-byte characters (that is, an array of byte). You should really be comparing PrintWriter and PrintStream, since System.out is an instance of PrintStream. The problem with PrintStream is that it converts the characters to single-byte characters, so it is not good for double-byte character sets and conseqently, not good for internationalization.
For simply printing to the console, System.out.println() is probably sufficient for your needs. After all, you probably aren't going to be trying to print Cuneiform to the console. You would want to use PrintWriter to write files if you wrote a text editor that you wanted to sell in a country that has a double-byte character set (or if you are the kind of person who plans ahead). However, in that case, you would not be using console output (except perhaps for debugging and the all-to-ubiquitous stack trace dumps), instead you would display the characters in a GUI, using the appropriate unicode font.
|
|