Package uk.ac.manchester.spinnaker.utils
Class RawConfigParser
java.lang.Object
uk.ac.manchester.spinnaker.utils.RawConfigParser
A cut-down limited version of the parser used in Python.
- Author:
- Donal Fellows
- 
Constructor SummaryConstructorsModifierConstructorDescriptionCreate a configuration with no values defined in it.RawConfigParser(File file) Create a configuration from the given configuration file.protectedRawConfigParser(String delimiters, String comments) Create a basic configuration parser.RawConfigParser(URL resource) Create a configuration from the given configuration file.
- 
Method SummaryModifier and TypeMethodDescriptionGet a value from the config.getBoolean(String section, String option) Get a value from the config.Get a value from the config.protected booleanHow to decide if a value is to be treated asnull.protected StringnormaliseOptionName(String name) How to convert an option name into canonical form.protected StringnormaliseSectionName(String name) How to convert a section name into canonical form.voidRead a configuration file.voidRead a configuration file.
- 
Constructor Details- 
RawConfigParserCreate a basic configuration parser.- Parameters:
- delimiters- the option/value delimiter characters.
- comments- the comment delimiter characters.
 
- 
RawConfigParserpublic RawConfigParser()Create a configuration with no values defined in it.
- 
RawConfigParserCreate a configuration from the given configuration file. This is designed to be used withClass.getResource(String).- Parameters:
- resource- The handle to the configuration file.
- Throws:
- RuntimeException- If the file can't be read. (NB: not- IOException.)
 
- 
RawConfigParserCreate a configuration from the given configuration file.- Parameters:
- file- The handle to the configuration file.
- Throws:
- RuntimeException- If the file can't be read. (NB: not- IOException.)
 
 
- 
- 
Method Details- 
normaliseSectionNameHow to convert a section name into canonical form.- Parameters:
- name- The raw section name.
- Returns:
- The canonicalised section name.
 
- 
normaliseOptionNameHow to convert an option name into canonical form.- Parameters:
- name- The raw option name.
- Returns:
- The canonicalised option name.
 
- 
readRead a configuration file.- Parameters:
- resource- Where the file is.
- Throws:
- IOException- if the reading fails.
 
- 
readRead a configuration file.- Parameters:
- file- Where the file is.
- Throws:
- IOException- if the reading fails.
 
- 
isNoneHow to decide if a value is to be treated asnull.- Parameters:
- value- The value to examine
- Returns:
- True iff the value is a null-equivalent.
 
- 
getIntGet a value from the config.- Parameters:
- section- The section to look in.
- option- The option to look at.
- Returns:
- The option value, or nullif it is absent.
 
- 
getBooleanGet a value from the config.- Parameters:
- section- The section to look in.
- option- The option to look at.
- Returns:
- The option value, or nullif it is absent.
 
- 
getGet a value from the config.- Parameters:
- section- The section to look in.
- option- The option to look at.
- Returns:
- The option value, or nullif it is absent.
 
 
-