This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Any OutputStream will support Chinese characters, or anything in the Unicode character set for that matter... only provided you specify the charset to be used to convert those characters to bytes. You would have to use that charset when you wrote data to the OutputStream, and if that data was subsequently used by somebody else, they would also have to use that charset to convert the bytes back to chars.
Is that sufficient to answer your question? Or was your question something else, but you thought OutputStream was the answer to that question but you couldn't figure out why?
Joined: May 01, 2007
First of all Thanks for you reply.
I know that Streams are capable of dealing with character data. But how can I create a OutPutStream writer object or PrintWriterObject with out using files.
Another question is if I use ByteOutputStream is chinese data going to be messed up as ???.
To properly handle non-ASCII characters, you should wrap any InputStream / OutputStream in a Reader / Writer. The InputStreamReader and OutputStreamWriter are excellent choices to start with, as they allow you to specify the encoding to use. You then simply write the characters to the Writer, which turns it into bytes that are written to the OutputStream. The other way around, when you ask the Reader to read a character it asks the InputStream for one or more bytes to convert into the requested character.
And whatever you do, don't write non-ASCII characters to System.out. The console is very limited in what it can display. That's not a limitation in the JVM but the system's console. Using JOptionPane.showMessageDialog(null, message) usually is better.