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 13. September 2007 by Joerg Schaible
10: */
11: package com.thoughtworks.xstream.benchmark.xmlfriendly.product;
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 XmlFriendlyReplacer dummy.
22: *
23: * @author Jörg Schaible
24: */
25: public class NoReplacer implements Product {
26:
27: private final XStream xstream;
28:
29: public NoReplacer() {
30: this .xstream = new XStream(new XppDriver(
31: new XmlFriendlyReplacer()));
32: }
33:
34: public void serialize(Object object, OutputStream output)
35: throws Exception {
36: xstream.toXML(object, output);
37: }
38:
39: public Object deserialize(InputStream input) throws Exception {
40: return xstream.fromXML(input);
41: }
42:
43: public String toString() {
44: return "";
45: }
46:
47: public static class XmlFriendlyReplacer extends
48: AbstractXmlFriendlyReplacer {
49:
50: public XmlFriendlyReplacer() {
51: super ("_-", "__", 0);
52: }
53:
54: public String escapeName(String name) {
55: return name;
56: }
57:
58: public String unescapeName(String name) {
59: return name;
60: }
61: }
62: }
|