Here you can find the source of unmarshal(InputStream is, Class> clazz)
public static Object unmarshal(InputStream is, Class<?> clazz)
//package com.java2s; //License from project: Apache License import java.io.InputStream; import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBException; import javax.xml.bind.Unmarshaller; public class Main { public static Object unmarshal(InputStream is, Class<?> clazz) { try {/*from ww w. ja v a2 s . c o m*/ JAXBContext jaxbContext = JAXBContext.newInstance(clazz); Unmarshaller unmarshaller = jaxbContext.createUnmarshaller(); Object object = unmarshaller.unmarshal(is); return object; } catch (JAXBException e) { throw new RuntimeException("Error unmarshalling object", e); } } }