Here you can find the source of unmarshalPackage(InputStream pkgStream)
Parameter | Description |
---|---|
pkgStream | a parameter |
Parameter | Description |
---|---|
IOException | an exception |
JAXBException | an exception |
public static Package unmarshalPackage(InputStream pkgStream) throws IOException, JAXBException
//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; } }