KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > xml > stream > util > EventReaderDelegate


1 package javax.xml.stream.util;
2
3 import javax.xml.namespace.QName JavaDoc;
4 import javax.xml.namespace.NamespaceContext JavaDoc;
5 import javax.xml.stream.XMLEventReader;
6 import javax.xml.stream.events.XMLEvent;
7 import javax.xml.stream.Location;
8 import javax.xml.stream.XMLStreamException;
9
10 /**
11  * This is the base class for deriving an XMLEventReader
12  * filter.
13  *
14  * This class is designed to sit between an XMLEventReader and an
15  * application's XMLEventReader. By default each method
16  * does nothing but call the corresponding method on the
17  * parent interface.
18  *
19  * @version 1.0
20  * @author Copyright (c) 2003 by BEA Systems. All Rights Reserved.
21  * @see javax.xml.stream.XMLEventReader
22  * @see StreamReaderDelegate
23  * @since 1.6
24  */

25
26 public class EventReaderDelegate implements XMLEventReader {
27   private XMLEventReader reader;
28
29   /**
30    * Construct an empty filter with no parent.
31    */

32   public EventReaderDelegate(){}
33
34   /**
35    * Construct an filter with the specified parent.
36    * @param reader the parent
37    */

38   public EventReaderDelegate(XMLEventReader reader) {
39     this.reader = reader;
40   }
41
42   /**
43    * Set the parent of this instance.
44    * @param reader the new parent
45    */

46   public void setParent(XMLEventReader reader) {
47     this.reader = reader;
48   }
49
50   /**
51    * Get the parent of this instance.
52    * @return the parent or null if none is set
53    */

54   public XMLEventReader getParent() {
55     return reader;
56   }
57
58   public XMLEvent nextEvent()
59     throws XMLStreamException
60   {
61     return reader.nextEvent();
62   }
63
64   public Object JavaDoc next() {
65     return reader.next();
66   }
67
68   public boolean hasNext()
69   {
70     return reader.hasNext();
71   }
72
73   public XMLEvent peek()
74     throws XMLStreamException
75   {
76     return reader.peek();
77   }
78
79   public void close()
80     throws XMLStreamException
81   {
82     reader.close();
83   }
84   
85   public String JavaDoc getElementText()
86     throws XMLStreamException
87   {
88     return reader.getElementText();
89   }
90
91   public XMLEvent nextTag()
92     throws XMLStreamException
93   {
94     return reader.nextTag();
95   }
96
97   public Object JavaDoc getProperty(java.lang.String JavaDoc name)
98     throws java.lang.IllegalArgumentException JavaDoc
99   {
100     return reader.getProperty(name);
101   }
102
103   public void remove() {
104     reader.remove();
105   }
106 }
107
Popular Tags