• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Input/Output for SCJP

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Currently I am studying for the programmer exam. One of the objectives for java.io states:
Distinguish between conditions under which platform default encoding conversion should be used and conditions under which a specific conversion should be used.
Can anyone suggest how I can distinguish when to use each conversion.
Thanks, Jimmy
 
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Jimmy,
Here goes.
Conditions under which platform default encoding conversion should be used -
For this I would have said that most Operating Systems know what part of the world they are operating in as they are given this information when they were installed. The machines locale is accessible by the JVM & by default the encoding used by a reader or writer is the one appropriate to the machines locale. So if your only dealing with our systems in your locale or that have the same locale setup on their system you would use the default encoding conversion.
Conditions under which a specific conversion should be used -
If you are reading/writing data that crosses a locale boundary you may have to specify what locale to use. The JVM will then use a different encoding version for that local. For example a writer may be connected to a socket which communicates with a machine in a different local.
I hope this helps. Basically it depends on if your readers/writers are working with machines in the same locale.
 
Bring me the box labeled "thinking cap" ... and then read this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic