nio and default charset

S

Stefano

Hi,

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.

Thank you, Dolce.
 
G

Gordon Beaton

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top