public class Registry extends Object
Modifier and Type | Field and Description |
---|---|
static int |
ASSOCIATE_VM_APPLICATION
An option for associateFile().
|
static Hashtable |
registries
This is a hashtable of all the IRegistryKey objects representing the top level
key available to the System.
|
static String |
REGISTRY_LOCAL |
static String |
REGISTRY_REMOTE |
Constructor and Description |
---|
Registry() |
Modifier and Type | Method and Description |
---|---|
static void |
associateFile(String extension,
String shortFileDescription,
String fileDescription,
String commandLine,
String icon,
int options)
This associates files with a certain extension to a particular application.
|
static void |
associateFileWithMe(String extension,
String shortFileDescription,
String fileDescription,
String icon)
This associates files with a certain extension to the running application.
|
static Process |
execCommandLine(String commandLine)
This is the same as Vm.execCommandLine().
|
static Process |
executeShellCommand(String fileName) |
static String |
expandString(String src)
Expand a String containing environment variables.
|
static boolean |
explore(File directory)
This attempts to open a directory in a native "explorer" window.
|
static Process |
explore(String filePath)
This attempts to open a directory in a native "explorer" window.
|
static String[] |
getClassPaths()
Return the class paths for the running VM as a set of absolute
system dependant file paths.
|
static String |
getCommandLineToMe()
Return the best command line to the running application, using
quotes where necessary.
|
static File |
getJavaVM()
Get the Java executable on the system.
|
static IRegistryKey |
getLocalRegistry() |
static IRegistryKey |
getRemoteRegistry() |
static File |
getRunningVM()
Get the executable file of the currently running VM.
|
static String |
getShellCommand(String fileName) |
static String |
getShellCommandForExtension(String extension)
Get the shell command for running a file with a particular extension.
|
static String |
getUserHomeDirectory()
Return the current users home directory if possible.
|
static String |
getUserName()
Return the current users name.
|
static String |
getVmCommandLine(String commandsToRun)
Get the command line to the preferred Eve VM, given additional commands
to run.
|
static String |
getVmCommandLine(String commandsToRun,
String vmCommands)
Get the command line to the preferred Eve VM, given additional commands
to run.
|
static IRegistryKey |
readLocalSoftwareKey(String pathInSoftware)
This will search for an entry under HKEY_LOCAL_MACHINE\Software\
|
static String |
readRegistryString(String keyName,
String valueName)
A quick and easy way to read a registry value as a formatted String.
|
static Object |
readRegistryValue(String keyName,
String valueName)
A quick and easy way to read a registry value.
|
static boolean |
setRegistryValue(String keyName,
String valueName,
Object value)
A quick and easy way to set a registry value.
|
static boolean |
writeRegistryString(String keyName,
String valueName,
String value)
A quick and easy way to write a registry value as a formatted String.
|
static boolean |
writeRegistryValue(String keyName,
String valueName,
Object value)
A quick and easy way to write a registry value.
|
public static final String REGISTRY_LOCAL
public static final String REGISTRY_REMOTE
public static Hashtable registries
public static final int ASSOCIATE_VM_APPLICATION
public static IRegistryKey getLocalRegistry()
public static IRegistryKey getRemoteRegistry()
public static void associateFile(String extension, String shortFileDescription, String fileDescription, String commandLine, String icon, int options) throws IOException
extension
- This is the file extension (e.g. ".pnf")shortFileDescription
- This is a mandatory short file description (e.g. "JewelFile");fileDescription
- This is an optional long file description (e.g. "Jewel Program Specs")commandLine
- This is the command line to execute - it will usually include "%1" (including the quotes)
within it to indicate where the file name gets inserted into the command line passed to the application. If you want to execute a .eve file,
then set the command line to point to the .eve file (in quotes) and then set options to
be ASSOCIATE_VM_APPLICATION.icon
- The file name of an optional icon to associate with files of this extension.options
- Can be any of the following values ORed together: IOException
- If an error occurs saving the registry information.public static void associateFileWithMe(String extension, String shortFileDescription, String fileDescription, String icon) throws IOException
extension
- This is the file extension (e.g. ".pnf")shortFileDescription
- This is a mandatory short file description (e.g. "JewelFile");fileDescription
- This is an optional long file description (e.g. "Jewel Program Specs")arguments
- These are the arguments to pass to the application - it will usually include "%1" (including the quotes)
within it to indicate where the file name gets inserted into the command line passed to the application.icon
- The file name of an optional icon to associate with files of this extension.IOException
- If an error occurs saving the registry information.public static Process explore(String filePath) throws IOException
filePath
- the path of the directory. This will be converted to a System correct path if necessary.IOException
- if the window could not be opened.public static boolean explore(File directory)
directory
- the directory to explore.public static Process execCommandLine(String commandLine) throws IOException
commandLine
- the command line to use, the executable may
be placed in quotes.IOException
- if the command line could not be executed.public static String getVmCommandLine(String commandsToRun)
commandsToRun
- the user command line to give to the VM.public static String getVmCommandLine(String commandsToRun, String vmCommands)
commandsToRun
- the user command line to give to the VM.vmCommands
- VM options (like -R90, etc) which can be null.public static String getShellCommandForExtension(String extension)
public static Process executeShellCommand(String fileName) throws IOException
IOException
public static Object readRegistryValue(String keyName, String valueName)
keyName
- the full path of the key include "HKEY_XXXX" values,
using '\' as separators.valueName
- the name of the value or null for the default value.public static String readRegistryString(String keyName, String valueName)
keyName
- the full path of the key include "HKEY_XXXX" values,
using '\' as separators.valueName
- the name of the value or null for the default value.public static boolean writeRegistryString(String keyName, String valueName, String value)
keyName
- the full path of the key include "HKEY_XXXX" values,
using '\' as separators.valueName
- the name of the value or null for the default value.value
- the value to write.public static boolean writeRegistryValue(String keyName, String valueName, Object value)
keyName
- the full path of the key include "HKEY_XXXX" values,
using '\' as separators.valueName
- the name of the value or null for the default value.value
- the value to write. This should be an Integer, or a byte[]/ByteArray,
or a StringBuffer for an "Expanding String". Anything else is converted
to a String and saved as a String.public static String expandString(String src)
src
- the source string.public static boolean setRegistryValue(String keyName, String valueName, Object value)
keyName
- the name of the key.valueName
- the name of the value or null for the default value.value
- a String or byte[] or Integer or StringBuffer (for expanding string) only.public static IRegistryKey readLocalSoftwareKey(String pathInSoftware)
pathInSoftware
- the path under "Software".public static File getJavaVM()
public static File getRunningVM()
public static String[] getClassPaths()
public static String getCommandLineToMe()
public static String getUserName()
public static String getUserHomeDirectory()