MCPcopy Create free account
hub / github.com/BaseXdb/basex / properties

Method properties

basex-core/src/main/java/org/basex/util/Util.java:332–349  ·  view source on GitHub ↗

Returns the contents of a property resource. @param name name of the property resource @return property map

(final String name)

Source from the content-addressed store, hash-verified

330 * @return property map
331 */
332 public static TokenObjectMap<byte[]> properties(final String name) {
333 final InputStream is = Util.class.getResourceAsStream('/' + name);
334 if(is == null) throw notExpected("%: Property resource missing.", name);
335
336 final TokenObjectMap<byte[]> map = new TokenObjectMap<>();
337 try(NewlineInput nli = new NewlineInput(is)) {
338 for(String line; (line = nli.readLine()) != null;) {
339 final int s = line.indexOf('=');
340 if(s == -1 || Strings.startsWith(line, '#')) continue;
341 final byte[] key = token(line.substring(0, s).trim());
342 if(map.contains(key)) throw notExpected("%: '%' is declared twice.", name, key);
343 map.put(key, token(line.substring(s + 1).trim().replace("\\t", "\t").replace("\\n", "\n")));
344 }
345 } catch(final IOException ex) {
346 throw notExpected("%: %", name, ex);
347 }
348 return map;
349 }
350
351 /**
352 * Checks if long values are small enough to be multiplied without overflow.

Callers 5

readMethod · 0.95
TextPanelClass · 0.95
entitiesMethod · 0.95
MediaTypeClass · 0.95
EnglishStemmerClass · 0.95

Calls 10

notExpectedMethod · 0.95
startsWithMethod · 0.95
putMethod · 0.95
tokenMethod · 0.65
containsMethod · 0.65
readLineMethod · 0.45
indexOfMethod · 0.45
trimMethod · 0.45
substringMethod · 0.45
replaceMethod · 0.45

Tested by

no test coverage detected