+ throw new IOException(e.getMessage(), e);
+ }
+ }
+
+ /**
+ * Write the given {@link String} into the given {@link OutputStream} in
+ * UTF-8.
+ *
+ * @param out
+ * the {@link OutputStream}
+ * @param data
+ * the data to write, cannot be NULL
+ *
+ * @throws IOException
+ * in case of I/O error
+ */
+ static void write(OutputStream out, Object data) throws IOException {
+ try {
+ out.write(data.toString().getBytes("UTF-8"));
+ } catch (UnsupportedEncodingException e) {
+ // A conforming JVM is required to support UTF-8
+ e.printStackTrace();