Java XML JAXB Unmarshaller unmarshalPackage(InputStream pkgStream)

Here you can find the source of unmarshalPackage(InputStream pkgStream)

Description

unmarshal Package

License

Open Source License

Parameter

Parameter Description
pkgStream a parameter

Exception

Parameter Description
IOException an exception
JAXBException an exception

Declaration

public static Package unmarshalPackage(InputStream pkgStream) throws IOException, JAXBException 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) May 18, 2011 Zend Technologies Ltd. 
 * All rights reserved. This program and the accompanying materials 
 * are made available under the terms of the Eclipse Public License v1.0 
 * which accompanies this distribution, and is available at 
 * http://www.eclipse.org/legal/epl-v10.html  
 *******************************************************************************/

import java.io.IOException;
import java.io.InputStream;

import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;

import javax.xml.bind.Unmarshaller;
import javax.xml.transform.Source;
import javax.xml.transform.stream.StreamSource;

public class Main {
    private static final String ORG_ZEND_SDKLIB_DESCRIPTOR_PKG = "org.zend.sdklib.descriptor.pkg";

    /**/*  w w  w.  ja v a2  s.c  o m*/
     * @param pkgStream
     * @return
     * @throws IOException
     * @throws JAXBException
     */
    public static Package unmarshalPackage(InputStream pkgStream) throws IOException, JAXBException {
        Source source = new StreamSource(pkgStream);
        JAXBContext jc = JAXBContext.newInstance(ORG_ZEND_SDKLIB_DESCRIPTOR_PKG);
        Unmarshaller u = jc.createUnmarshaller();
        Package pkg = (Package) u.unmarshal(source);
        return pkg;
    }
}

Related

  1. unMarshallRequest(String xmlString)
  2. unmarshallString(String str, Class c)
  3. unmarshallXml(final String string, final Class type)
  4. unmarshallXMLtoObject(final byte[] xmlObject, final Class objectClass, final URL schemaURL)
  5. unmarshalObject(final InputStream input, final Class clazz)
  6. unmarshalXML(String xmlString, Class classType)
  7. unmarshalXmlToObject(String xmlFilePath, Class clazz)