public class ProcessVariables extends Handle implements EnvironmentVariables
Modifier and Type | Class and Description |
---|---|
protected static class |
ProcessVariables.EnvironmentVariablesResource
This class is responsible for destroying a native resource when the
instance is collected by garbage-collector.
|
INFINITE_TIMEOUT, INVALID_HANDLE_VALUE, STATUS_ABANDONED_WAIT_0, STATUS_TIMEOUT, STATUS_WAIT_0
Constructor and Description |
---|
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.
|
Modifier and Type | Method and Description |
---|---|
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.
|
clone, closeHandle, equals, waitFor, waitFor
asFunction, asFunction, asTypedPointer, castTo, castTo, getDebugInfo, getLength, getValue, hashCode, isNull, read, setValue, toString, write
public ProcessVariables()
ProcessVariables
class,
which contains all environment variables of the current process.public ProcessVariables(java.lang.String[] variables)
variables
- protected void registerResource()
public java.lang.String[] getStrings()
public java.util.Map toMap()
public java.lang.String getValue(java.lang.String variable)
getValue
in interface EnvironmentVariables
variable
- name of the variable to get the value for.public void setValue(java.lang.String variable, java.lang.String value)
setValue
in interface EnvironmentVariables
variable
- variable name.value
- variable value.public void removeVariable(java.lang.String variable)
removeVariable
in interface EnvironmentVariables
variable
- variable name.public boolean contains(java.lang.String variable)
contains
in interface EnvironmentVariables
variable
- variable name.public java.lang.String[] getVariableNames()
getVariableNames
in interface EnvironmentVariables
public void freeEnvironmentStrings()