Methods Summary |
---|
public boolean | containsKey(java.lang.Object key)
return super.containsKey(nonNullString(key));
|
public boolean | containsValue(java.lang.Object value)
return super.containsValue(nonNullString(value));
|
static java.util.Map | emptyEnvironment(int capacity)
return new ProcessEnvironment(capacity);
|
public java.util.Set | entrySet()
return new CheckedEntrySet(super.entrySet());
|
static java.util.Map | environment()
return (Map<String,String>) theEnvironment.clone();
|
private static native java.lang.String | environmentBlock()
|
public java.lang.String | get(java.lang.Object key)
return super.get(nonNullString(key));
|
static java.lang.String | getenv(java.lang.String name)
// The original implementation used a native call to _wgetenv,
// but it turns out that _wgetenv is only consistent with
// GetEnvironmentStringsW (for non-ASCII) if `wmain' is used
// instead of `main', even in a process created using
// CREATE_UNICODE_ENVIRONMENT. Instead we perform the
// case-insensitive comparison ourselves. At least this
// guarantees that System.getenv().get(String) will be
// consistent with System.getenv(String).
return theCaseInsensitiveEnvironment.get(name);
|
static java.util.Map | getenv()
return theUnmodifiableEnvironment;
|
public java.util.Set | keySet()
return new CheckedKeySet(super.keySet());
|
private static java.lang.String | nonNullString(java.lang.Object o)
if (o == null)
throw new NullPointerException();
return (String) o;
|
public java.lang.String | put(java.lang.String key, java.lang.String value)
return super.put(validateName(key), validateValue(value));
|
public java.lang.String | remove(java.lang.Object key)
return super.remove(nonNullString(key));
|
java.lang.String | toEnvironmentBlock()
// Sort Unicode-case-insensitively by name
List<Map.Entry<String,String>> list
= new ArrayList<Map.Entry<String,String>>(entrySet());
Collections.sort(list, entryComparator);
StringBuilder sb = new StringBuilder(size()*30);
for (Map.Entry<String,String> e : list)
sb.append(e.getKey())
.append('=")
.append(e.getValue())
.append('\u0000");
// Ensure double NUL termination,
// even if environment is empty.
if (sb.length() == 0)
sb.append('\u0000");
sb.append('\u0000");
return sb.toString();
|
static java.lang.String | toEnvironmentBlock(java.util.Map map)
return map == null ? null :
((ProcessEnvironment)map).toEnvironmentBlock();
|
private static java.lang.String | validateName(java.lang.String name)
// An initial `=' indicates a magic Windows variable name -- OK
if (name.indexOf('=", 1) != -1 ||
name.indexOf('\u0000") != -1)
throw new IllegalArgumentException
("Invalid environment variable name: \"" + name + "\"");
return name;
|
private static java.lang.String | validateValue(java.lang.String value)
if (value.indexOf('\u0000") != -1)
throw new IllegalArgumentException
("Invalid environment variable value: \"" + value + "\"");
return value;
|
public java.util.Collection | values()
return new CheckedValues(super.values());
|