01: /*
02: * Copyright (C) 2007 XStream Committers.
03: * All rights reserved.
04: *
05: * The software in this package is published under the terms of the BSD
06: * style license a copy of which has been included with this distribution in
07: * the LICENSE.txt file.
08: *
09: * Created on 26. June 2007 by Joerg Schaible
10: */
11: package com.thoughtworks.xstream.benchmark.reflection.products;
12:
13: import com.thoughtworks.xstream.XStream;
14: import com.thoughtworks.xstream.io.xml.XppDriver;
15: import com.thoughtworks.xstream.tools.benchmark.Product;
16:
17: import java.io.InputStream;
18: import java.io.OutputStream;
19:
20: /**
21: * Uses XStream with the XPP driver for parsing XML and no additional setup.
22: *
23: * @author Joe Walnes
24: * @see com.thoughtworks.xstream.tools.benchmark.Harness
25: * @see Product
26: * @see XStream
27: * @see XppDriver
28: */
29: public class XStreamPlain implements Product {
30:
31: private final XStream xstream;
32:
33: public XStreamPlain() {
34: this .xstream = new XStream(new XppDriver());
35: }
36:
37: public void serialize(Object object, OutputStream output)
38: throws Exception {
39: xstream.toXML(object, output);
40: }
41:
42: public Object deserialize(InputStream input) throws Exception {
43: return xstream.fromXML(input);
44: }
45:
46: public String toString() {
47: return "XStream (plain)";
48: }
49:
50: }
|