public final class EnvUtils
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
EnvUtils.ParseException
Exception for parsing errors.
|
static class |
EnvUtils.VariableSubstitutionException
Exception for failed variable expansion due to missing value.
|
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
expandShellVariables(java.lang.String inputString,
java.util.Map<java.lang.String,java.lang.String> environmentVariablesMap)
Performs shell environment variables expansion on the given string.
|
static java.util.Map<java.lang.String,java.lang.String> |
parseEnvFile(java.io.File environmentFile)
Parse a file containing shell variable declarations.
|
static java.util.Map<java.lang.String,java.lang.String> |
parseEnvStream(java.io.InputStream inputStream)
Parse a file containing shell variable declarations.
|
public static java.util.Map<java.lang.String,java.lang.String> parseEnvFile(java.io.File environmentFile) throws java.io.IOException, EnvUtils.ParseException
environmentFile
- file to parsejava.io.IOException
- if the file cannot be readEnvUtils.ParseException
- if the file contents cannot be parsedpublic static java.util.Map<java.lang.String,java.lang.String> parseEnvStream(java.io.InputStream inputStream) throws EnvUtils.ParseException
inputStream
- stream to parseEnvUtils.ParseException
- if the file contents cannot be parsedpublic static java.lang.String expandShellVariables(java.lang.String inputString, java.util.Map<java.lang.String,java.lang.String> environmentVariablesMap) throws EnvUtils.VariableSubstitutionException
inputString
- a string, possibly containing shell variablesenvironmentVariablesMap
- a map of string environment variablesEnvUtils.VariableSubstitutionException
- if the value for a variable appearing in input is not found in the map