Java XML JAXB Unserialize read(Class cl, InputStream is)

Here you can find the source of read(Class cl, InputStream is)

Description

read

License

Open Source License

Declaration

public static <T> T read(Class<T> cl, InputStream is) throws JAXBException 

Method Source Code

//package com.java2s;
//License from project: Open Source 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 <T> T read(Class<T> cl, InputStream is) throws JAXBException {
        JAXBContext context = JAXBContext.newInstance(cl);
        Unmarshaller unmarshaller = context.createUnmarshaller();
        T o = cl.cast(unmarshaller.unmarshal(is));
        return o;
    }//from   w w  w  .  j  a  v a 2  s  .c o  m
}

Related

  1. parseIsoDate(String lexicalDate)
  2. parseJaxb(Class cls, InputStream in)
  3. parseXml(final Class klass, final Reader xmlReader)
  4. parseXML(String content, Class clazz)
  5. parseXmlFile(Class type, String filePath)
  6. read(File file, Class typeParameterClass)
  7. readComplexProperty(String name, List objects, String methodName)
  8. readExternal(InputStream inputStream, Class clazz)
  9. readJAXB(Class clazz, InputStream is)

  10. HOME | Copyright © www.java2s.com 2016