MCPcopy Index your code
hub / github.com/processing/processing / load

Method load

app/src/processing/app/Preferences.java:157–179  ·  view source on GitHub ↗

Load a set of key/value pairs from a UTF-8 encoded file into 'table'. For 3.0a6, this removes any platform-specific extensions from keys, so that we don't have platform-specific entries in a user's preferences.txt file, which would require all prefs to be changed twice, or risk being overwritten by

(InputStream input)

Source from the content-addressed store, hash-verified

155 * overwritten by the unchanged platform-specific version on reload.
156 */
157 static public void load(InputStream input) throws IOException {
158 HashMap<String, String> platformSpecific = new HashMap<>();
159
160 String[] lines = PApplet.loadStrings(input); // Reads as UTF-8
161 for (String line : lines) {
162 if ((line.length() == 0) ||
163 (line.charAt(0) == '#')) continue;
164
165 // this won't properly handle = signs being in the text
166 int equals = line.indexOf('=');
167 if (equals != -1) {
168 String key = line.substring(0, equals).trim();
169 String value = line.substring(equals + 1).trim();
170 if (!isPlatformSpecific(key, value, platformSpecific)) {
171 table.put(key, value);
172 }
173 }
174 }
175 // Now override the keys with any platform-specific defaults we've found.
176 for (String key : platformSpecific.keySet()) {
177 table.put(key, platformSpecific.get(key));
178 }
179 }
180
181
182 /**

Callers 2

ProcessingTestUtilClass · 0.95
initMethod · 0.95

Calls 5

loadStringsMethod · 0.95
isPlatformSpecificMethod · 0.95
getMethod · 0.65
trimMethod · 0.45
putMethod · 0.45

Tested by

no test coverage detected