+ public static String escapeAVA(String value) {
+
+ return value.replace("\\", "\\\\").replace("/", "\\/");
+ }
+
+ public static String stringifyDN(HashMap<String, String> contents) {
+ StringBuffer res = new StringBuffer();
+ for (Entry<String, String> i : contents.entrySet()) {
+ res.append("/" + i.getKey() + "=");
+ res.append(escapeAVA(i.getValue()));
+ }
+ return res.toString();
+ }
+
+ public static HashMap<String, String> buildDN(String... contents) {
+ HashMap<String, String> res = new HashMap<>();
+ for (int i = 0; i + 1 < contents.length; i += 2) {
+ res.put(contents[i], contents[i + 1]);
+ }
+ return res;
+ }