com.jniwrapper.win32.process
Class ProcessVariables

java.lang.Object
  extended bycom.jniwrapper.Parameter
      extended bycom.jniwrapper.Pointer.Void
          extended bycom.jniwrapper.win32.Handle
              extended bycom.jniwrapper.win32.process.ProcessVariables
All Implemented Interfaces:
EnvironmentVariables, com.jniwrapper.IntegerParameter, com.jniwrapper.PointerParameter

public class ProcessVariables
extends Handle
implements EnvironmentVariables

This class allows managing environment variables for a process.


Nested Class Summary
protected static class ProcessVariables.EnvironmentVariablesResource
          This class is responsible for destroying a native resource when the instance is collected by garbage-collector.
 
Field Summary
 
Fields inherited from class com.jniwrapper.win32.Handle
INFINITE_TIMEOUT, INVALID_HANDLE_VALUE, STATUS_ABANDONED_WAIT_0, STATUS_TIMEOUT, STATUS_WAIT_0
 
Fields inherited from class com.jniwrapper.Parameter
LICENSE_TYPE, V
 
Constructor Summary
ProcessVariables()
          Create an instance of the ProcessVariables class, which contains all environment variables of the current process.
ProcessVariables(java.lang.String[] variables)
          Allocates new Environment variables.
 
Method Summary
 boolean contains(java.lang.String variable)
          Verifies if there is a specified variable in the environment.
 void freeEnvironmentStrings()
          Frees a block of environment strings.
 java.lang.String[] getStrings()
          Returns the strings containing environment variables in key=value format for the calling process.
 java.lang.String getValue(java.lang.String variable)
          Returns the value of the specified variable from the environment block of the calling process.
 java.lang.String[] getVariableNames()
          Returns an array of variable names.
protected  void registerResource()
           
 void removeVariable(java.lang.String variable)
          Removes specified environment variable for the current process.
 void setValue(java.lang.String variable, java.lang.String value)
          Sets the value of an environment variable for the current process.
 java.util.Map toMap()
          Returns a map of the environment variables for the current process.
 
Methods inherited from class com.jniwrapper.win32.Handle
clone, closeHandle, equals, waitFor, waitFor
 
Methods inherited from class com.jniwrapper.Pointer.Void
asFunction, asFunction, asTypedPointer, castTo, getDebugInfo, getLength, getValue, hashCode, isNull, read, setValue, toString, write
 
Methods inherited from class com.jniwrapper.Parameter
, a, a, acceptIOPerformer, asReturnValue, b, dataBufferAssigned, getAlignedLength, getAlignmentRequirement, getDataBuffer, getDataBufferOffset, indent, pop, push, read, read, setDataBuffer, toByteArray, write
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ProcessVariables

public ProcessVariables()
Create an instance of the ProcessVariables class, which contains all environment variables of the current process.


ProcessVariables

public ProcessVariables(java.lang.String[] variables)
Allocates new Environment variables.

Parameters:
variables -
Method Detail

registerResource

protected void registerResource()

getStrings

public java.lang.String[] getStrings()
Returns the strings containing environment variables in key=value format for the calling process.

Returns:
environment variables.

toMap

public java.util.Map toMap()
Returns a map of the environment variables for the current process.

Returns:
environment variables.

getValue

public java.lang.String getValue(java.lang.String variable)
Returns the value of the specified variable from the environment block of the calling process.

Specified by:
getValue in interface EnvironmentVariables
Parameters:
variable - name of the variable to get the value for.
Returns:
a value for the variable.

setValue

public void setValue(java.lang.String variable,
                     java.lang.String value)
Sets the value of an environment variable for the current process.

Specified by:
setValue in interface EnvironmentVariables
Parameters:
variable - variable name.
value - variable value.

removeVariable

public void removeVariable(java.lang.String variable)
Removes specified environment variable for the current process.

Specified by:
removeVariable in interface EnvironmentVariables
Parameters:
variable - variable name.

contains

public boolean contains(java.lang.String variable)
Verifies if there is a specified variable in the environment.

Specified by:
contains in interface EnvironmentVariables
Parameters:
variable - variable name.
Returns:
true, if the specified variable exists in the environment; otherwise false.

getVariableNames

public java.lang.String[] getVariableNames()
Returns an array of variable names.

Specified by:
getVariableNames in interface EnvironmentVariables
Returns:
an array of variable names.

freeEnvironmentStrings

public void freeEnvironmentStrings()
Frees a block of environment strings.