What String str = new String(bytes) does it to create a java String (i.e. UTF-16) using the default platform character encoding (for windows 2000 this is cp1252).
If the byte array was created from a string encoded in the platform default character encoding this will work well.
If not you need to specify the correct character encoding (Charset) as String str = new String (byte [] bytes, Charset charset)
Thanks very much. I only needed a quick way to get data read from FileInputStream.read() quickly out to System.out.println() for debugging purposes. However, knowing about the encoding problem will come in handy for a real application.
Post by:autobot
I think I'll just lie down here for a second. And ponder this tiny ad:
a bit of art, as a gift, that will fit in a stocking