On 4 Jun 2004 02:35:31 -0700, Stefano wrote:
> there is a way to specify the default nio charset use by jvm? On my
> linux, jdk1.4.2, jvm start up with utf-8, i need it to start with
> iso-8859-1. I cannot simply open stream specifying different
> charset.
NIO channels, like streams, are used for reading bytes not characters,
and as such don't use charsets at all (default or otherwise).
If you need to convert a byte[] to a String using a specific encoding,
use the appropriate String constructor with the received byte data.
Note that you can get a Reader from your channel that converts to
characters according to a particular encoding, but then you don't use
NIO for reading anymore.
/gordon
--
[ do not email me copies of your followups ]
g o r d o n + n e w s @ b a l d e r 1 3 . s e
|