Method from java.lang.ProcessEnvironment Detail: |
public boolean containsKey(Object key) {
return super.containsKey(nonNullString(key));
}
|
public boolean containsValue(Object value) {
return super.containsValue(nonNullString(value));
}
|
static Map<String, String> emptyEnvironment(int capacity) {
return new ProcessEnvironment(capacity);
}
|
public Set<String, String> entrySet() {
return new CheckedEntrySet(super.entrySet());
}
|
static Map<String, String> environment() {
return (Map< String,String >) theEnvironment.clone();
}
|
public String get(Object key) {
return super.get(nonNullString(key));
}
|
static Map<String, String> getenv() {
return theUnmodifiableEnvironment;
}
|
static String getenv(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);
}
|
public Set<String> keySet() {
return new CheckedKeySet(super.keySet());
}
|
public String put(String key,
String value) {
return super.put(validateName(key), validateValue(value));
}
|
public String remove(Object key) {
return super.remove(nonNullString(key));
}
|
String toEnvironmentBlock() {
// Sort Unicode-case-insensitively by name
List< Map.Entry< String,String > > list = new ArrayList< >(entrySet());
Collections.sort(list, entryComparator);
StringBuilder sb = new StringBuilder(size()*30);
int cmp = -1;
// Some versions of MSVCRT.DLL require SystemRoot to be set.
// So, we make sure that it is always set, even if not provided
// by the caller.
final String SYSTEMROOT = "SystemRoot";
for (Map.Entry< String,String > e : list) {
String key = e.getKey();
String value = e.getValue();
if (cmp < 0 && (cmp = nameComparator.compare(key, SYSTEMROOT)) > 0) {
// Not set, so add it here
addToEnvIfSet(sb, SYSTEMROOT);
}
addToEnv(sb, key, value);
}
if (cmp < 0) {
// Got to end of list and still not found
addToEnvIfSet(sb, SYSTEMROOT);
}
if (sb.length() == 0) {
// Environment was empty and SystemRoot not set in parent
sb.append('\u0000');
}
// Block is double NUL terminated
sb.append('\u0000');
return sb.toString();
}
|
static String toEnvironmentBlock(Map<String, String> map) {
return map == null ? null :
((ProcessEnvironment)map).toEnvironmentBlock();
}
|
public Collection<String> values() {
return new CheckedValues(super.values());
}
|