Here you can find the source of marshalPackage(OutputStream printStream, final Package p)
Parameter | Description |
---|---|
printStream | a parameter |
p | a parameter |
Parameter | Description |
---|---|
JAXBException | an exception |
PropertyException | an exception |
public static void marshalPackage(OutputStream printStream, final Package p) throws JAXBException, PropertyException
//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.OutputStream; import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBException; import javax.xml.bind.Marshaller; import javax.xml.bind.PropertyException; public class Main { private static final String ORG_ZEND_SDKLIB_DESCRIPTOR_PKG = "org.zend.sdklib.descriptor.pkg"; /**//from w ww. j ava 2 s. c om * @param printStream * @param p * @throws JAXBException * @throws PropertyException */ public static void marshalPackage(OutputStream printStream, final Package p) throws JAXBException, PropertyException { JAXBContext jc = JAXBContext.newInstance(ORG_ZEND_SDKLIB_DESCRIPTOR_PKG); Marshaller m = jc.createMarshaller(); m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); m.marshal(p, printStream); } }