MCPcopy Create free account
hub / github.com/PCGen/pcgen / mystore

Method mystore

code/src/java/pcgen/core/utils/SortedProperties.java:41–70  ·  view source on GitHub ↗

Store properties @param out @param header

(final FileOutputStream out, final String header)

Source from the content-addressed store, hash-verified

39 * @param header
40 */
41 public void mystore(final FileOutputStream out, final String header)
42 {
43
44 final SortedMap<Object, Object> aMap = new TreeMap<>(this);
45 final Iterator<Map.Entry<Object, Object>> entries = aMap.entrySet().iterator();
46 Map.Entry<Object, Object> entry;
47
48 try(BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(out, "8859_1")))
49 {
50 bw.write(header);
51 bw.newLine();
52
53 while (entries.hasNext())
54 {
55 entry = entries.next();
56
57 // The following characters must be escaped:
58 // #, !, = and :
59 final String aString = fixUp((String) entry.getValue());
60 bw.write(convertStringToKey((String) entry.getKey()) + "=" + aString);
61 bw.newLine();
62 }
63
64 bw.flush();
65 }
66 catch (final IOException ex)
67 {
68 Logging.errorPrint("Error writing to the options.ini file: ", ex);
69 }
70 }
71
72 private static String fixUp(final String aString)
73 {

Callers

nothing calls this directly

Calls 12

fixUpMethod · 0.95
convertStringToKeyMethod · 0.95
errorPrintMethod · 0.95
newLineMethod · 0.80
writeMethod · 0.65
getValueMethod · 0.65
getKeyMethod · 0.65
iteratorMethod · 0.45
entrySetMethod · 0.45
hasNextMethod · 0.45
nextMethod · 0.45
flushMethod · 0.45

Tested by

no test coverage detected