• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

NIO and Internationalization

 
Lanny Gilbert
Ranch Hand
Posts: 111
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Greetings from beautiful Sandy Springs, Georgia.
Since I'm studying for the SCEA exam, streams and internalization are on my mind quite a bit these days.
How does NIO provide for internationalization?
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mhh, it seems to me that NIO is mainly about the mechanics of writing/reading something, whereas i18n is about *what* to write. So, aren't that somewhat orthogonal issues?
What would you expect from NIO in regards to i18n?
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In traditional IO, InputStreamReader and OutputStreamWriter provide for conversion between byte streams and character streams (Readers and Writers) using named character encodings. NIO has similar functionality provided by Charset, CharsetEncoder and CharsetDecoder. These do things like convert a ByteBuffer into a CharBuffer view and vice versa.
 
Ron Hitchens
Author
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As the previous posters have pointed out, NIO doesn't directly address I18N. There is a new package in NIO, java.nio.charset, which is all about character sets but it's concerned only with transcoding between character sequences and byte streams.
NIO is really only involved at the plumbing level in I18N. The Charset class let's you define your own character sets and gives you complete control over their endcoding/decoding rules.
Character sets you create may be added to the JVM for general use (including by Readers and Writers) but that's the extent of it. NIO knows nothing about Locales, number formatting conventions, etc.
So international character sets can be built and deployed with NIO. But if I18N is your thing, you'll probably not deal directly with NIO very often.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic