@Override public void serialise(OutputStream outputStream) throws IOException { ByteArrayOutputStream bos = new ByteArrayOutputStream(); Explanation.store(explanation, bos, m); String rendering = new String(bos.toByteArray()); rendering = rendering.replace("<?xml version=\"1.0\"?>\n", ""); PrintWriter pw = new PrintWriter(outputStream); pw.println(rendering); pw.flush(); }