ch.sf.htt
Class Environment

java.lang.Object
  extended by ch.sf.htt.Environment

public class Environment
extends java.lang.Object

Abstracts environment variables. On Windows names of environment variables are not case sensitive. If the OS is Windows, names of environment variables are converted to all lower case, e.g. "Path" to "path": All methods that are given names of environment variables can use any case, i.e. are converted to lower case within the method; returned names of environment variables are all lower case. On all other OSes no conversion is done.


Constructor Summary
Environment()
          Constructor, gets same environment as current process.
Environment(java.util.Map<java.lang.String,java.lang.String> environmentMap)
          Constructor from explicit environment map, given in same format as returned by System.getenv().
 
Method Summary
 void addToPath(java.io.File dir)
          Add path directory file to path environment variable.
 void addToPath(java.lang.String dir)
          Add path directory to path environment variable.
 java.util.Map<java.lang.String,java.lang.String> getEnvironmentMap()
           
 java.lang.String[] getEnvp()
          Get environment array in format needed for Runtime().exec(), i.e.
 java.lang.String getValue(java.lang.String key)
          Return value for given key.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Environment

public Environment(java.util.Map<java.lang.String,java.lang.String> environmentMap)
Constructor from explicit environment map, given in same format as returned by System.getenv().

Parameters:
environmentMap - environment map

Environment

public Environment()
Constructor, gets same environment as current process.

Method Detail

addToPath

public void addToPath(java.lang.String dir)
Add path directory to path environment variable.

Parameters:
dir - directory

addToPath

public void addToPath(java.io.File dir)
Add path directory file to path environment variable.

Parameters:
dir - directory file

getEnvp

public java.lang.String[] getEnvp()
Get environment array in format needed for Runtime().exec(), i.e. as array of "=" strings.

Returns:
environment array

getEnvironmentMap

public java.util.Map<java.lang.String,java.lang.String> getEnvironmentMap()
Returns:
the environment map

getValue

public java.lang.String getValue(java.lang.String key)
Return value for given key.

Parameters:
key - key
Returns:
value, null if does not exist in environment