Ejemplo n.º 1
0
 /**
  * Returns an unmodifiable {@link Map} holding the list of environment variables (their name and
  * value) that will be provided to the child process upon creation.
  *
  * @return An unmodifiable {@link Map} containing the list of currently set environment variables.
  */
 public Map<String, String> produceEnvironmentVariableMap() {
   final Map<String, String> vars = new LinkedHashMap<String, String>(10, 0.8f);
   env.coalescedView(
       getParentEnvironmentVariableBlock(),
       new EnvironmentVariableBlockBuilder.IVisitor() {
         @Override
         public boolean visit(String name, String value) {
           vars.put(name, value);
           return true;
         }
       });
   return Collections.unmodifiableMap(vars);
 }
Ejemplo n.º 2
0
  /**
   * Returns an array of {@link IEnvironmentVariable} instances representing environment variables
   * (their name and value) that will be provided to the child process upon creation.
   *
   * @return An unmodifiable {@link Set} of {@link IEnvironmentVariable} instances representing the
   *     list of currently set environment variables.
   */
  public Set<IEnvironmentVariable> getEnvironmentVariables() {
    final Set<IEnvironmentVariable> vars = new LinkedHashSet<IEnvironmentVariable>(10, 0.8f);

    env.coalescedView(
        getParentEnvironmentVariableBlock(),
        new EnvironmentVariableBlockBuilder.IVisitor() {
          @Override
          public boolean visit(String name, String value) {
            vars.add(new EnvironmentVariable(name, value));
            return true;
          }
        });

    return Collections.unmodifiableSet(vars);
  }