1 /**********************************************************************
2 * HessianAdapter.java
3 * created on 29.07.2006 by netseeker
4 * $Id: HessianAdapter.java,v 1.4 2006/11/05 16:33:37 netseeker Exp $
5 * $Log: HessianAdapter.java,v $
6 * Revision 1.4 2006/11/05 16:33:37 netseeker
7 * changed adapter connection handling
8 * added support for JSON with different JSON-adapters (XStream,JSON-lib,MyJSON)
9 *
10 * Revision 1.3 2006/08/09 20:13:54 netseeker
11 * *** empty log message ***
12 *
13 * Revision 1.2 2006/07/31 23:31:15 netseeker
14 * *** empty log message ***
15 *
16 * Revision 1.1 2006/07/31 22:29:50 netseeker
17 * *** empty log message ***
18 *
19 *
20 * ====================================================================
21 *
22 * Copyright 2005-2006 netseeker aka Michael Manske
23 *
24 * Licensed under the Apache License, Version 2.0 (the "License");
25 * you may not use this file except in compliance with the License.
26 * You may obtain a copy of the License at
27 *
28 * http://www.apache.org/licenses/LICENSE-2.0
29 *
30 * Unless required by applicable law or agreed to in writing, software
31 * distributed under the License is distributed on an "AS IS" BASIS,
32 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
33 * See the License for the specific language governing permissions and
34 * limitations under the License.
35 * ====================================================================
36 *
37 * This file is part of the EJOE framework.
38 * For more information on the author, please see
39 * <http://www.manskes.de/>.
40 *
41 *********************************************************************/
42 package de.netseeker.ejoe.adapter;
43
44 import java.io.InputStream;
45 import java.io.OutputStream;
46
47 import com.caucho.hessian.io.HessianInput;
48 import com.caucho.hessian.io.HessianOutput;
49
50 /***
51 * An adapter for (de)serializing objects via the Caucho Hessian library
52 *
53 * @see http://www.caucho.com/resin-3.0/protocols/hessian.xtp
54 * @author netseeker
55 * @since 0.3.9.1
56 */
57 public class HessianAdapter extends BaseAdapter
58 {
59
60 private static final long serialVersionUID = 1L;
61
62
63
64
65
66
67 public Object read( InputStream in ) throws Exception
68 {
69 HessianInput hIn = new HessianInput( in );
70 return hIn.readObject( null );
71 }
72
73
74
75
76
77
78 public void write( Object obj, OutputStream out ) throws Exception
79 {
80 HessianOutput hOut = new HessianOutput( out );
81 hOut.writeObject( obj );
82 }
83 }