Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.io.OutputStream;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBElement;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;

public class Main {
    public static <T> void marshal(JAXBElement<T> element, Class<T> c, OutputStream os) {
        try {
            JAXBContext jc = JAXBContext.newInstance(c);
            Marshaller ma = jc.createMarshaller();
            ma.marshal(element, os);
        } catch (JAXBException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }
}