I am pulling values from a Windows registry .reg file. I have registry
values like this:
"SystemBiosVersion"=hex(7):44,00,45,00,4c,00,4c,00,20,00,20,00,20,00,2d,00,20,\
00,37,00,00,00,50,00,68,00,6f,00,65,00,6e,00,69,00,78,00,20,00,52,00,4f,00,\
4d,00,20,00,42,00,49,00,4f,00,53,00,20,00,50,00,4c,00,55,00,53,00,20,00,56,\
00,65,00,72,00,73,00,69,00,6f,00,6e,00,20,00,31,00,2e,00,31,00,30,00,20,00,\
41,00,30,00,34,00,00,00,00,00
I can strip away everything and I have the hex string:
440045004c004c002000200020002d0020037000000500068006f0065006e0069007800200052004f00d002000420049004f005300200050004c0055005300200056065007200730069006f006e00200031002e003100300020001003000340000000000
I want to convert this to a readable string in Java 5.0. I have a
suspicion that it is UTF-16LE. The readable string for the above
example should be: "DELL - 7
Phoenix ROM BIOS PLUS Version 1.10 A04", but it doesn't seem to be
working when I try converting the string to bytes by calling
Integer.parseInt() on it, casting it to a byte array, and then make a
new string with the encoding.
An extra issue is that the string is a multi-string. The Windows
Registry Reference online defines a multi-string this way:
A sequence of null-terminated strings, terminated by an empty string (\0).
The following is an example:
String1\0String2\0String3\0LastString\0\0
The first \0 terminates the first string, the second to the last \0
terminates the last string, and the final \0 terminates the sequence.
Note that the final terminator must be factored into the length of the
string.
I would most like to just get a readable string, with the end goal of
having an array of each individual string in the multi-string. I'd
appreciate any help (even just getting the multi-string as one string
instead of a string array). |