01: /*
02: * Copyright (C) 2005 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: import com.thoughtworks.xstream.converters.ErrorWriter;
15:
16: import java.util.Iterator;
17:
18: /**
19: * Base class to make it easy to create wrappers (decorators) for HierarchicalStreamReader.
20: *
21: * @author Joe Walnes
22: */
23: public abstract class ReaderWrapper implements HierarchicalStreamReader {
24:
25: protected HierarchicalStreamReader wrapped;
26:
27: protected ReaderWrapper(HierarchicalStreamReader reader) {
28: this .wrapped = reader;
29: }
30:
31: public boolean hasMoreChildren() {
32: return wrapped.hasMoreChildren();
33: }
34:
35: public void moveDown() {
36: wrapped.moveDown();
37: }
38:
39: public void moveUp() {
40: wrapped.moveUp();
41: }
42:
43: public String getNodeName() {
44: return wrapped.getNodeName();
45: }
46:
47: public String getValue() {
48: return wrapped.getValue();
49: }
50:
51: public String getAttribute(String name) {
52: return wrapped.getAttribute(name);
53: }
54:
55: public String getAttribute(int index) {
56: return wrapped.getAttribute(index);
57: }
58:
59: public int getAttributeCount() {
60: return wrapped.getAttributeCount();
61: }
62:
63: public String getAttributeName(int index) {
64: return wrapped.getAttributeName(index);
65: }
66:
67: public Iterator getAttributeNames() {
68: return wrapped.getAttributeNames();
69: }
70:
71: public void appendErrors(ErrorWriter errorWriter) {
72: wrapped.appendErrors(errorWriter);
73: }
74:
75: public void close() {
76: wrapped.close();
77: }
78:
79: public HierarchicalStreamReader underlyingReader() {
80: return wrapped.underlyingReader();
81: }
82: }
|