Java XML JAXB Marshaller marshalPackage(OutputStream printStream, final Package p)

Here you can find the source of marshalPackage(OutputStream printStream, final Package p)

Description

marshal Package

License

Open Source License

Parameter

Parameter Description
printStream a parameter
p a parameter

Exception

Parameter Description
JAXBException an exception
PropertyException an exception

Declaration

public static void marshalPackage(OutputStream printStream, final Package p)
        throws JAXBException, PropertyException 

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.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);
    }
}

Related

  1. marshallToXml(String zpackage, Writer writer, Object data)
  2. marshallXml(final Object object)
  3. marshallXMLInConsole(Object obj)
  4. marshalObject(Object obj, File file)
  5. marshalObjectToXml(Object object, String xmlFilePath)
  6. marshalToString(Object obj)
  7. marshalToString(Object obj)
  8. marshalV2(Class clazz, T obj, String uri, String nodeName)
  9. removeStandalone(final Marshaller marshaller)