String keyName, PrintWriter out, String margin)
throws com.sun.star.registry.InvalidRegistryException {
out.print(margin) ;
keyName = getShortKeyName(keyName) ;
XRegistryKey key = parentKey.openKey(keyName) ;
if (key != null)
out.print("/" + getShortKeyName(key.getKeyName()) + " ") ;
else {
out.println("(null)") ;
return ;
}
if (!key.isValid()) {
out.println("(not valid)") ;
return ;
}
if (key.isReadOnly()) {
out.print("(read only) ") ;
}
if (parentKey.getKeyType(keyName) == RegistryKeyType.LINK) {
out.println("(link to " + parentKey.getLinkTarget(keyName) + ")") ;
return ;
}
RegistryValueType type ;
try {
type = key.getValueType() ;
if (type.equals(RegistryValueType.ASCII)) {
out.println("[ASCII] = '" + key.getAsciiValue() + "'") ;
} else
if (type.equals(RegistryValueType.STRING)) {
out.println("[STRING] = '" + key.getStringValue() + "'") ;
} else
if (type.equals(RegistryValueType.LONG)) {
out.println("[LONG] = " + key.getLongValue()) ;
} else
if (type.equals(RegistryValueType.BINARY)) {
out.print("[BINARY] = {") ;
byte[] bin = key.getBinaryValue() ;
for (int i = 0; i < bin.length; i++)
out.print("" + bin[i] + ",") ;
out.println("}") ;
} else
if (type.equals(RegistryValueType.ASCIILIST)) {
out.print("[ASCIILIST] = {") ;
String[] list = key.getAsciiListValue() ;
for (int i = 0; i < list.length; i++)
out.print("'" + list[i] + "',") ;
out.println("}") ;
} else
if (type.equals(RegistryValueType.STRINGLIST)) {
out.print("[STRINGLIST] = {") ;
String[] list = key.getStringListValue() ;
for (int i = 0; i < list.length; i++)
out.print("'" + list[i] + "',") ;
out.println("}") ;
} else
if (type.equals(RegistryValueType.LONGLIST)) {
out.print("[LONGLIST] = {") ;
int[] list = key.getLongListValue() ;
for (int i = 0; i < list.length; i++)
out.print("" + list[i] + ",") ;
out.println("}") ;
} else {
out.println("") ;
}
} catch (com.sun.star.uno.Exception e) {
out.println("Exception occured : ") ;
e.printStackTrace(out) ;
} finally {
key.closeKey() ;
}
}