Package de.netseeker.ejoe.adapter

Source Code of de.netseeker.ejoe.adapter.XmlBeansAdapter

/*********************************************************************
* XmlBeansAdapter.java
* created on 02.12.2006 by netseeker
* $Id: XmlBeansAdapter.java,v 1.2 2007/03/03 00:01:42 netseeker Exp $
* $Log: XmlBeansAdapter.java,v $
* Revision 1.2  2007/03/03 00:01:42  netseeker
* *** empty log message ***
*
* Revision 1.1  2006/12/02 18:23:20  netseeker
* *** empty log message ***
*
*
* ====================================================================
*
*  Copyright 2005-2006 netseeker aka Michael Manske
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*      http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
* ====================================================================
*
* This file is part of the EJOE framework.
* For more information on the author, please see
* <http://www.manskes.de/>.
*
*********************************************************************/
package de.netseeker.ejoe.adapter;

import java.io.InputStream;
import java.io.OutputStream;

import org.apache.xmlbeans.XmlObject;

/**
* A simple SerializeAdapter for the great XMLBeans framework.
* @see <a href="http://xmlbeans.apache.org/index.html">http://xmlbeans.apache.org/index.html</a>
* @author netseeker
* @since 0.3.9.2
*/
public class XmlBeansAdapter extends BaseAdapter
{
    /**
     *
     */
    private static final long serialVersionUID = 1L;

    /**
     * Creates a new instance of XmlBeansAdapter
     */
    public XmlBeansAdapter()
    {
    }

    /*
     * (non-Javadoc)
     *
     * @see de.netseeker.ejoe.adapter.SerializeAdapter#read(java.io.InputStream)
     */
    public Object read( InputStream in ) throws Exception
    {
        return XmlObject.Factory.parse( in );
    }

    /*
     * (non-Javadoc)
     *
     * @see de.netseeker.ejoe.adapter.SerializeAdapter#write(java.lang.Object, java.io.OutputStream)
     */
    public void write( Object obj, OutputStream out ) throws Exception
    {
        XmlObject xmlObj = (XmlObject) obj;
        xmlObj.save( out );
    }

    /*
     * (non-Javadoc)
     *
     * @see de.netseeker.ejoe.adapter.BaseAdapter#getContentType()
     */
    public String getContentType()
    {
        return "text/xml";
    }
}
TOP

Related Classes of de.netseeker.ejoe.adapter.XmlBeansAdapter

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.