Store properties @param out @param header
(final FileOutputStream out, final String header)
| 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 | { |
nothing calls this directly
no test coverage detected