Java tutorial
//package com.java2s; //License from project: Open Source License import javax.xml.bind.JAXB; import java.io.*; public class Main { /** * Marshal an arbitrary object with JAXB. * * @param object Object * @param stream Output stream to write to */ public static void marshal(Object object, OutputStream stream) throws Exception { JAXB.marshal(object, stream); stream.close(); } }