| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.proxy.sunproxy.NSRegistry
public class NSRegistry
Provides simple read-only access to the (binary) Netscape registry file. The registry file, typically C:\WINNT\nsreg.dat on windows or ~/.netscape/registry on Unix, contains configuration information for Netscape applications. The registry is organized like the windows registry: it's tree structured and nodes (called "keys") have a list of name/value pairs called entries.
The format of the file doesn't seem to be officially documented however it's not complicated and can be easily derived from the Mozilla sources that provide access to it. See the references below for more information. To use this class you must create an NSRegistry object and open a valid registry file. To look up a value (the value of an "entry") you provide it's path; here's an example that prints the current version of Communicator.
 NSRegistry reg = new NSRegistry().open(new File("c:\WINNT\nsreg.dat"));
 System.out.println(reg.get("Version Registry/Netscape/Communicator/Version"));
 reg.close();
 
 The NSRegistry.dump() method prints the contents of the entire registry.
| Constructor Summary | |
|---|---|
| NSRegistry() | |
| Method Summary | |
|---|---|
|  void | close()Close the Netscape registry file. | 
|  void | dump()Dump the contents of the registry to the standard output. | 
|  java.lang.String | get(java.lang.String path)Return the value of the specified path. | 
|  NSRegistry | open(java.io.File regFile)Open the (binary) Netscape registry file (usually C:\WINNT\nsreg.dat on Windows) and read its header. | 
|  java.lang.String | toString() | 
| Methods inherited from class java.lang.Object | 
|---|
| equals, getClass, hashCode, notify, notifyAll, wait, wait, wait | 
| Constructor Detail | 
|---|
public NSRegistry()
| Method Detail | 
|---|
public NSRegistry open(java.io.File regFile)
this if the
 file was opened and the header was read successfully, null
 otherwise.  This method must be called, before calling anything else.
 
 The layout of the file header is only documented in the Mozilla
 sources, see
 
 
 source/modules/libreg/src/reg.h
 
 
 Here's the header struct itself:
 typedef struct _hdr {
 uint32  magic;      // must equal MAGIC_NUMBER
 uint16  verMajor;   // major version number
 uint16  verMinor;   // minor version number
 REGOFF  avail;      // next available offset
 REGOFF  root;       // root object
 } REGHDR;
public void close()
public java.lang.String get(java.lang.String path)
 NSRegistry reg = new NSRegistry().open();
 reg.get("Version Registry/Netscape/Communicator/Version");
 reg.close();
 
public void dump()
[name = value]
public java.lang.String toString()
toString in class java.lang.Object| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||