01: /*
02: * Copyright (C) 2005, 2006 Joe Walnes.
03: * Copyright (C) 2006, 2007 XStream Committers.
04: * All rights reserved.
05: *
06: * The software in this package is published under the terms of the BSD
07: * style license a copy of which has been included with this distribution in
08: * the LICENSE.txt file.
09: *
10: * Created on 10. April 2005 by Joe Walnes
11: */
12: package com.thoughtworks.xstream.io;
13:
14: /**
15: * Base class to make it easy to create wrappers (decorators) for HierarchicalStreamWriter.
16: *
17: * @author Joe Walnes
18: */
19: public abstract class WriterWrapper implements
20: ExtendedHierarchicalStreamWriter {
21:
22: protected HierarchicalStreamWriter wrapped;
23:
24: protected WriterWrapper(HierarchicalStreamWriter wrapped) {
25: this .wrapped = wrapped;
26: }
27:
28: public void startNode(String name) {
29: wrapped.startNode(name);
30: }
31:
32: public void startNode(String name, Class clazz) {
33:
34: ((ExtendedHierarchicalStreamWriter) wrapped).startNode(name,
35: clazz);
36: }
37:
38: public void endNode() {
39: wrapped.endNode();
40: }
41:
42: public void addAttribute(String key, String value) {
43: wrapped.addAttribute(key, value);
44: }
45:
46: public void setValue(String text) {
47: wrapped.setValue(text);
48: }
49:
50: public void flush() {
51: wrapped.flush();
52: }
53:
54: public void close() {
55: wrapped.close();
56: }
57:
58: public HierarchicalStreamWriter underlyingWriter() {
59: return wrapped.underlyingWriter();
60: }
61:
62: }
|