MCPcopy Create free account
hub / github.com/Qihoo360/poseidon / IniParser

Class IniParser

builder/index/src/main/java/util/IniParser.java:113–1155  ·  view source on GitHub ↗

Loads, edits and saves INI-style configuration files. While loading from and saving to streams and files, IniParser preserves comments and blank lines as well as the order of sections and lines in general. IniParser assumes configuration files to be split in sections. A

Source from the content-addressed store, hash-verified

111 * @version r5 (3/4/2013)
112 */
113public class IniParser {
114
115 private static boolean DEFAULT_CASE_SENSITIVITY = false;
116
117 private Map<String, Section> sections;
118 private List<String> sectionOrder;
119 private String commonName;
120 private char[] commentDelims;
121 private boolean isCaseSensitive;
122 private OptionFormat optionFormat;
123
124 /**
125 * Constructs new bare IniParser instance.
126 */
127 public IniParser() {
128 this(null, null);
129 }
130
131 /**
132 * Constructs new bare IniParser instance specifying case-sensitivity.
133 *
134 * @param isCaseSensitive section and option names are case-sensitive if
135 * this is true
136 */
137 public IniParser(boolean isCaseSensitive) {
138 this(null, null, isCaseSensitive);
139 }
140
141 /**
142 * Constructs new IniParser instance with a common section. Options in the
143 * common section are used as defaults for all other sections.
144 *
145 * @param commonName name of the common section
146 */
147 public IniParser(String commonName) {
148 this(commonName, null);
149 }
150
151 /**
152 * Constructs new IniParser instance with a common section. Options in the
153 * common section are used as defaults for all other sections.
154 *
155 * @param commonName name of the common section
156 * @param isCaseSensitive section and option names are case-sensitive if
157 * this is true
158 */
159 public IniParser(String commonName, boolean isCaseSensitive) {
160 this(commonName, null, isCaseSensitive);
161 }
162
163 /**
164 * Constructs new IniParser defining comment delimiters.
165 *
166 * @param delims an array of characters to be recognized as starters of
167 * comment lines; the first of them will be used for newly created
168 * comments
169 */
170 public IniParser(char[] delims) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected