Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.media.mn8.util
Class SystemEnvReader  view SystemEnvReader download SystemEnvReader.java

java.lang.Object
  extended byorg.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 $

Field Summary
private static SystemEnvReader _envReader
           
 
Constructor Summary
SystemEnvReader()
           
 
Method Summary
private  java.io.InputStream executeEnvCommand(java.lang.String command)
           
static java.util.Properties getSystemEnvironment()
          Returns the operating system specific environment variables and their values.
static java.util.Properties getSystemEnvironment(java.lang.String command)
          Returns the operating system specific environment variables and their values.
static void main(java.lang.String[] args)
           
private  java.util.Properties parseResult(java.io.InputStream is)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_envReader

private static final SystemEnvReader _envReader
Constructor Detail

SystemEnvReader

public SystemEnvReader()
Method Detail

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