1 /**********************************************************************
2 * JavaBeansXmlAdapter.java
3 * created on 10.03.2005 by netseeker
4 * $Source: /cvsroot/ejoe/EJOE/src/de/netseeker/ejoe/adapter/JavaBeansXmlAdapter.java,v $
5 * $Date: 2006/02/04 14:16:49 $
6 * $Revision: 1.3 $
7 *********************************************************************/
8 package de.netseeker.ejoe.adapter;
9
10 import java.beans.XMLDecoder;
11 import java.beans.XMLEncoder;
12 import java.io.IOException;
13 import java.io.InputStream;
14 import java.io.OutputStream;
15
16 /***
17 * Simple SerializeAdapter implementation using the XmlEncoder/XmlDecoder
18 * classes of the Java Beans API
19 *
20 * @author netseeker
21 */
22 public class JavaBeansXmlAdapter implements SerializeAdapter
23 {
24
25
26
27
28
29 public Object read(InputStream in) throws IOException
30 {
31 XMLDecoder decoder = new XMLDecoder(in);
32 return decoder.readObject();
33 }
34
35
36
37
38
39
40
41 public void write(Object obj, OutputStream out) throws IOException
42 {
43 XMLEncoder encoder = new XMLEncoder(out);
44 encoder.writeObject(obj);
45 }
46
47
48
49
50
51
52 public void handleClassLoaderChange(ClassLoader classLoader)
53 {
54
55 }
56 }