Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / May 2006

Tip: Looking for answers? Try searching our database.

Preferences API . Capitalization anomaly.

Thread view: 
ptg_abhishek@yahoo.com - 04 May 2006 10:20 GMT
hello.
i tried the Preferences API provided by JDK2 [1.4.2]. It appears that
each upper case letter written into the windows registry by the API is
preceded by a '/' character.
Has anyone else noticed this behaviour? What is the reason for this?

regards,
abhishek
Chris Uppal - 04 May 2006 11:42 GMT
> i tried the Preferences API provided by JDK2 [1.4.2]. It appears that
> each upper case letter written into the windows registry by the API is
> preceded by a '/' character.
> Has anyone else noticed this behaviour? What is the reason for this?

Probably in order to implement case-sensitive key matching when the Windows
registry itself is case-insensitive.

You may find the comment from the relevant method interesting, but I presume
that you should not rely on the details remaining constant:

===========
    * Converts value's or node's name to its Windows representation
    * as a byte-encoded string.
    * Two encodings, simple and altBase64 are used.
    * <p>
    * <i>Simple</i> encoding is used, if java string does not contain
    * any characters less, than 0x0020, or greater, than 0x007f.
    * Simple encoding adds "/" character to capital letters, i.e.
    * "A" is encoded as "/A". Character '\' is encoded as '//',
    * '/' is encoded as '\'.
    * The constructed string is converted to byte array by truncating the
    * highest byte and adding the terminating <tt>null</tt> character.
    * <p>
    * <i>altBase64</i>  encoding is used, if java string does contain at least
    * one character less, than 0x0020, or greater, than 0x007f.
    * This encoding is marked by setting first two bytes of the
    * Windows string to '/!'. The java name is then encoded using
    * byteArrayToAltBase64() method from
    * Base64 class.

===========

The Base64.byteArrayToAltBase64() method it refers to is from another
Sun-private class.  It appears to do roughly the same thing as "normal" Base64
encoding, but using a different set of encoded characters in order to avoid
uppercase letters.

   -- chris


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.