tribble.util
Class GetEnvironment

java.lang.Object
  extended by tribble.util.GetEnvironment

public class GetEnvironment
extends java.lang.Object

Contains the environment variable settings from the native operating system.

Since:
2006-08-08
Version:
$Revision: 1.1 $ $Date: 2007/06/26 16:24:52 $
Author:
David R. Tribble (david@tribble.com).

Copyright 2006 by David R. Tribble, all rights reserved.
Permission is granted to any person or entity except those designated by by the United States Department of State as a terrorist, or terrorist government or agency, to use and distribute this source code provided that the original copyright notice remains present and unaltered.

See Also:
System.getenv()

Constructor Summary
GetEnvironment()
           
 
Method Summary
static java.lang.String getEnv(int index)
          Retrieve a native environment variable setting by index.
static java.lang.String getEnv(java.lang.String name)
          Retrieve a native environment variable setting.
static java.lang.String getEnvName(int index)
          Retrieve a native environment variable name by index.
static int getEnvSize()
          Retrieve the number of native environment variables.
static void main(java.lang.String[] args)
          Test driver.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GetEnvironment

public GetEnvironment()
Method Detail

getEnv

public static java.lang.String getEnv(java.lang.String name)
                               throws java.io.IOException
Retrieve a native environment variable setting. Note that some operating systems use case-sensitive environment variable names, while others use case-insensitive names.

Parameters:
name - Environment variable name to retrieve.
Returns:
The value of the specified environment variable, or null if there is no such variable defined.
Throws:
java.io.IOException - Thrown if the local environment settings cannot be determined.
Since:
1.1, 2006-08-08

getEnv

public static java.lang.String getEnv(int index)
                               throws java.io.IOException
Retrieve a native environment variable setting by index.

Parameters:
index - Index number of the environment variable value to retrieve.
Returns:
The value of the specified environment variable.
Throws:
java.lang.ArrayIndexOutOfBoundsException - (unchecked) Thrown if index does not specify a valid environment variable.
java.io.IOException - Thrown if the local environment settings cannot be determined.
Since:
1.1, 2006-08-08

getEnvName

public static java.lang.String getEnvName(int index)
                                   throws java.io.IOException
Retrieve a native environment variable name by index.

Parameters:
index - Index number of the environment variable name to retrieve.
Returns:
The name of the specified environment variable.
Throws:
java.lang.ArrayIndexOutOfBoundsException - (unchecked) Thrown if index does not specify a valid environment variable.
java.io.IOException - Thrown if the local environment settings cannot be determined.
Since:
1.1, 2006-08-08

getEnvSize

public static int getEnvSize()
Retrieve the number of native environment variables.

Returns:
The count of native environment variables, or -1 if the local environment settings cannot be determined.
Since:
1.1, 2006-08-08

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
Test driver. Display the native operating system environment variables.

Parameters:
args - Command line args (not used).
Throws:
java.lang.Exception
Since:
1.1, 2006-08-08