Package com.oracle.bmc
Class ConfigFileReader
- java.lang.Object
- 
- com.oracle.bmc.ConfigFileReader
 
- 
 public final class ConfigFileReader extends Object Simple implementation to read OCI configuration files.Note, config files MUST contain a "DEFAULT" profile, else validation will fail. Additional profiles are optional. 
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description static classConfigFileReader.ConfigFileConfigFile represents a simple lookup mechanism for a OCI config file.
 - 
Field SummaryFields Modifier and Type Field Description static StringDEFAULT_FILE_PATHDefault location of the config file.static StringFALLBACK_DEFAULT_FILE_PATHThe fallback default location of the config file.static StringOCI_CONFIG_FILE_PATH_ENV_VAR_NAMEEnvironment variable name for the config file location
 - 
Method SummaryAll Methods Static Methods Concrete Methods Modifier and Type Method Description static ConfigFileReader.ConfigFileparse(InputStream configurationStream, String profile)Create a new instance using an UTF-8 input stream.static ConfigFileReader.ConfigFileparse(InputStream configurationStream, String profile, Charset charset)Create a new instance using an input stream.static ConfigFileReader.ConfigFileparse(String configurationFilePath)Create a new instance using a file at a given location.static ConfigFileReader.ConfigFileparse(String configurationFilePath, String profile)Create a new instance using a file at a given location.static ConfigFileReader.ConfigFileparseDefault()Creates a new ConfigFile instance using the configuration at the default location, using the default profile.static ConfigFileReader.ConfigFileparseDefault(String profile)Creates a new ConfigFile instance using the configuration at the default location, using the given profile.
 
- 
- 
- 
Field Detail- 
DEFAULT_FILE_PATHpublic static final String DEFAULT_FILE_PATH Default location of the config file.- See Also:
- Constant Field Values
 
 - 
FALLBACK_DEFAULT_FILE_PATHpublic static final String FALLBACK_DEFAULT_FILE_PATH The fallback default location of the config file.If and only if the DEFAULT_FILE_PATHdoes not exist, this fallback default location will be used.- See Also:
- Constant Field Values
 
 - 
OCI_CONFIG_FILE_PATH_ENV_VAR_NAMEpublic static final String OCI_CONFIG_FILE_PATH_ENV_VAR_NAME Environment variable name for the config file location- See Also:
- Constant Field Values
 
 
- 
 - 
Method Detail- 
parseDefaultpublic static ConfigFileReader.ConfigFile parseDefault() throws IOException Creates a new ConfigFile instance using the configuration at the default location, using the default profile.See DEFAULT_FILE_PATH.- Returns:
- A new ConfigFile instance.
- Throws:
- IOException- if the file could not be read.
 
 - 
parseDefaultpublic static ConfigFileReader.ConfigFile parseDefault(@Nullable String profile) throws IOException Creates a new ConfigFile instance using the configuration at the default location, using the given profile.See DEFAULT_FILE_PATH.- Parameters:
- profile- The profile name to load, or null if you want to load the “DEFAULT” profile.
- Returns:
- A new ConfigFile instance.
- Throws:
- IOException- if the file could not be read.
 
 - 
parsepublic static ConfigFileReader.ConfigFile parse(String configurationFilePath) throws IOException Create a new instance using a file at a given location.This method is the same as calling parse(String, String)with "DEFAULT" as the profile.- Parameters:
- configurationFilePath- The path to the config file.
- Returns:
- A new ConfigFile instance.
- Throws:
- IOException- if the file could not be read.
 
 - 
parsepublic static ConfigFileReader.ConfigFile parse(String configurationFilePath, @Nullable String profile) throws IOException Create a new instance using a file at a given location.- Parameters:
- configurationFilePath- The path to the config file.
- profile- The profile name to load, or null if you want to load the “DEFAULT” profile.
- Returns:
- A new ConfigFile instance.
- Throws:
- IOException- if the file could not be read.
 
 - 
parsepublic static ConfigFileReader.ConfigFile parse(InputStream configurationStream, @Nullable String profile) throws IOException Create a new instance using an UTF-8 input stream.- Parameters:
- configurationStream- The path to the config file.
- profile- The profile name to load, or null if you want to load the “DEFAULT” profile.
- Returns:
- A new ConfigFile instance.
- Throws:
- IOException- if the file could not be read.
 
 - 
parsepublic static ConfigFileReader.ConfigFile parse(InputStream configurationStream, @Nullable String profile, @Nonnull Charset charset) throws IOException Create a new instance using an input stream.- Parameters:
- configurationStream- The path to the config file.
- profile- The profile name to load, or null if you want to load the “DEFAULT” profile.
- charset- The charset used when parsing the input stream
- Returns:
- A new ConfigFile instance.
- Throws:
- IOException- if the file could not be read.
 
 
- 
 
-