- java.lang.Object
-
- net.morimekta.config.ConfigReader<ConfigType>
-
- Type Parameters:
ConfigType- The config type.
- Direct Known Subclasses:
ConfigReader.YamlConfigReader
public abstract class ConfigReader<ConfigType> extends Object
A helper class to load config files from disk and parse into the specified config type.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classConfigReader.YamlConfigReader<ConfigType>Read config as YAML.
-
Constructor Summary
Constructors Modifier Constructor Description protectedConfigReader()Protected constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected ConfigTypeparseConfig(String fileName, InputStream stream)Deprecated, for removal: This API element is subject to removal in a future version.ImplementparseConfig(Path, InputStream)instead.protected ConfigTypeparseConfig(Path file, InputStream stream)Parse config file into the designated type.ConfigTypereadConfig(Path file)
-
-
-
Method Detail
-
readConfig
public ConfigType readConfig(Path file) throws IOException, ConfigException
- Parameters:
file- File path to load config from.- Returns:
- The loaded config file.
- Throws:
ConfigException- If parsing file failed.IOException- If reading the config file failed.
-
parseConfig
@Deprecated(forRemoval=true, since="3.1.0") protected ConfigType parseConfig(String fileName, InputStream stream) throws IOException
Deprecated, for removal: This API element is subject to removal in a future version.ImplementparseConfig(Path, InputStream)instead.Parse config file into the designated type.- Parameters:
fileName- File name that is parsed. In case this has influence on the parsing.stream- The file input stream to read from.- Returns:
- The parsed config file.
- Throws:
IOException- If reading file failed.
-
parseConfig
protected ConfigType parseConfig(Path file, InputStream stream) throws IOException, ConfigException
Parse config file into the designated type.- Parameters:
file- File is parsed. In case this has influence on the parsing.stream- The file input stream to read from.- Returns:
- The parsed config file.
- Throws:
ConfigException- If parsing file failed.IOException- If reading file failed.
-
-