/*********************************************************************
* HessianAdapter.java
* created on 29.07.2006 by netseeker
* $Id: HessianAdapter.java,v 1.4 2006/11/05 16:33:37 netseeker Exp $
* $Log: HessianAdapter.java,v $
* Revision 1.4 2006/11/05 16:33:37 netseeker
* changed adapter connection handling
* added support for JSON with different JSON-adapters (XStream,JSON-lib,MyJSON)
*
* Revision 1.3 2006/08/09 20:13:54 netseeker
* *** empty log message ***
*
* Revision 1.2 2006/07/31 23:31:15 netseeker
* *** empty log message ***
*
* Revision 1.1 2006/07/31 22:29:50 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 com.caucho.hessian.io.HessianInput;
import com.caucho.hessian.io.HessianOutput;
/**
* An adapter for (de)serializing objects via the Caucho Hessian library
*
* @see http://www.caucho.com/resin-3.0/protocols/hessian.xtp
* @author netseeker
* @since 0.3.9.1
*/
public class HessianAdapter extends BaseAdapter
{
private static final long serialVersionUID = 1L;
/*
* (non-Javadoc)
*
* @see de.netseeker.ejoe.adapter.SerializeAdapter#read(java.io.InputStream)
*/
public Object read( InputStream in ) throws Exception
{
HessianInput hIn = new HessianInput( in );
return hIn.readObject( null );
}
/*
* (non-Javadoc)
*
* @see de.netseeker.ejoe.adapter.SerializeAdapter#write(java.lang.Object, java.io.OutputStream)
*/
public void write( Object obj, OutputStream out ) throws Exception
{
HessianOutput hOut = new HessianOutput( out );
hOut.writeObject( obj );
}
}