### Question:
MarshallingSupport { public static String propertiesToString(Properties props) throws IOException { String result = ""; if (props != null) { DataByteArrayOutputStream dataOut = new DataByteArrayOutputStream(); props.store(dataOut, ""); result = new String(dataOut.getData(), 0, dataOut.size()); dataOut.close(); } return result; } private  MarshallingSupport(); static void marshalPrimitiveMap(Map<String, Object> map, DataOutputStream out); static Map<String, Object> unmarshalPrimitiveMap(DataInputStream in); static Map<String, Object> unmarshalPrimitiveMap(DataInputStream in, boolean force); static Map<String, Object> unmarshalPrimitiveMap(DataInputStream in, int maxPropertySize); static Map<String, Object> unmarshalPrimitiveMap(DataInputStream in, int maxPropertySize, boolean force); static void marshalPrimitiveList(List<Object> list, DataOutputStream out); static List<Object> unmarshalPrimitiveList(DataInputStream in); static List<Object> unmarshalPrimitiveList(DataInputStream in, boolean force); static void marshalPrimitive(DataOutputStream out, Object value); static Object unmarshalPrimitive(DataInputStream in); static Object unmarshalPrimitive(DataInputStream in, boolean force); static UTF8Buffer readUTF(DataInputStream in, int length); static void marshalNull(DataOutputStream out); static void marshalBoolean(DataOutputStream out, boolean value); static void marshalByte(DataOutputStream out, byte value); static void marshalChar(DataOutputStream out, char value); static void marshalShort(DataOutputStream out, short value); static void marshalInt(DataOutputStream out, int value); static void marshalLong(DataOutputStream out, long value); static void marshalFloat(DataOutputStream out, float value); static void marshalDouble(DataOutputStream out, double value); static void marshalByteArray(DataOutputStream out, byte[] value); static void marshalByteArray(DataOutputStream out, byte[] value, int offset, int length); static void marshalString(DataOutputStream out, String s); static void writeUTF8(DataOutput dataOut, String text); static long countUTFBytes(String str); static int writeUTFBytesToBuffer(String str, long count,
                                     byte[] buffer, int offset); static String readUTF8(DataInput dataIn); static String convertUTF8WithBuf(byte[] buf, char[] out, int offset,
                                            int utfSize); static String propertiesToString(Properties props); static Properties stringToProperties(String str); static String truncate64(String text); static final byte NULL; static final byte BOOLEAN_TYPE; static final byte BYTE_TYPE; static final byte CHAR_TYPE; static final byte SHORT_TYPE; static final byte INTEGER_TYPE; static final byte LONG_TYPE; static final byte DOUBLE_TYPE; static final byte FLOAT_TYPE; static final byte STRING_TYPE; static final byte BYTE_ARRAY_TYPE; static final byte MAP_TYPE; static final byte LIST_TYPE; static final byte BIG_STRING_TYPE; }### Answer:
@Test public void testPropertiesToString() throws Exception { Properties props = new Properties(); for (int i = 0; i < 10; i++) { String key = "key" + i; String value = "value" + i; props.put(key, value); } String str = MarshallingSupport.propertiesToString(props); Properties props2 = MarshallingSupport.stringToProperties(str); assertEquals(props, props2); }