byte[] (Properties properties) { StringBuilder builder = new StringBuilder(); TreeSet<String> sortedKeys = new TreeSet<>((Set)properties.keySet()); for (String each : sortedKeys) { builder.append(StringUtil.escapeProperty(each, true)); builder.append("="); builder.append(StringUtil.escapeProperty(properties.getProperty(each), false)); builder.append("\n"); } return builder.toString().getBytes(StandardCharsets.UTF_8); }