java.lang.Object
org.media.mn8.util.SystemEnvReader
- public class SystemEnvReader
- extends java.lang.Object
Simple class which executes an system command meant to list all
the system variables, parse the result of the command and returns
the system variables and their values in an map.
Invocation:
SystemEnvReader.getSystemEnvironment()
In which case the "env" command is invoked. This is specific
command for Unix environments.
or
SystemEnvReader.getSystemEnvironment(String cmd)
In which case the "cmd" command is invoked. This is the operating
system specific command to list all the system variables. For Windows
this "cmd" could be: "cmd.exe /c set".
Note: The parser expects that each variable is listed as it follows:
VAR_NAME=VAR_VALUE EOL
- Version:
- $Revision: 1.5 $ $Date: 2002/09/16 23:07:04 $
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
_envReader
private static final SystemEnvReader _envReader
SystemEnvReader
public SystemEnvReader()
getSystemEnvironment
public static java.util.Properties getSystemEnvironment()
throws java.io.IOException
- Returns the operating system specific environment variables and their values.
This method automatically tries to invoke the "env" command which is
particular for Unix operating systems!.
getSystemEnvironment
public static java.util.Properties getSystemEnvironment(java.lang.String command)
throws java.io.IOException
- Returns the operating system specific environment variables and their values.
This method automatically tries to invoke the "cmd" command which is
particular for the runtime operating system!
main
public static void main(java.lang.String[] args)
parseResult
private java.util.Properties parseResult(java.io.InputStream is)
throws java.io.IOException
executeEnvCommand
private java.io.InputStream executeEnvCommand(java.lang.String command)
throws java.io.IOException