Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > nio and default charset

Reply
Thread Tools

nio and default charset

 
 
Stefano
Guest
Posts: n/a
 
      06-04-2004
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.
 
Reply With Quote
 
 
 
 
Gordon Beaton
Guest
Posts: n/a
 
      06-04-2004
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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
String default encoding: UTF-16 or Platform's default charset? cs_professional Java 14 12-12-2010 06:10 PM
javascript charset <> page charset optimistx Javascript 2 08-15-2008 12:42 PM
nio charset doubt jimgardener Java 3 07-02-2008 08:38 AM
Charset names in java.io and java.nio Vincenzo.Zocca@gmail.com Java 0 06-07-2005 01:01 PM
NIO with timeouts != NIO? iksrazal Java 1 06-18-2004 02:28 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57