Path: blob/aarch64-shenandoah-jdk8u272-b10/jaxp/src/javax/xml/stream/util/EventReaderDelegate.java
48576 views
/*1* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.2*3* This code is free software; you can redistribute it and/or modify it4* under the terms of the GNU General Public License version 2 only, as5* published by the Free Software Foundation. Oracle designates this6* particular file as subject to the "Classpath" exception as provided7* by Oracle in the LICENSE file that accompanied this code.8*9* This code is distributed in the hope that it will be useful, but WITHOUT10* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or11* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License12* version 2 for more details (a copy is included in the LICENSE file that13* accompanied this code).14*15* You should have received a copy of the GNU General Public License version16* 2 along with this work; if not, write to the Free Software Foundation,17* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.18*19* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA20* or visit www.oracle.com if you need additional information or have any21* questions.22*/2324/*25* Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.26*/2728package javax.xml.stream.util;2930import javax.xml.namespace.QName;31import javax.xml.namespace.NamespaceContext;32import javax.xml.stream.XMLEventReader;33import javax.xml.stream.events.XMLEvent;34import javax.xml.stream.Location;35import javax.xml.stream.XMLStreamException;3637/**38* This is the base class for deriving an XMLEventReader39* filter.40*41* This class is designed to sit between an XMLEventReader and an42* application's XMLEventReader. By default each method43* does nothing but call the corresponding method on the44* parent interface.45*46* @version 1.047* @author Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.48* @see javax.xml.stream.XMLEventReader49* @see StreamReaderDelegate50* @since 1.651*/5253public class EventReaderDelegate implements XMLEventReader {54private XMLEventReader reader;5556/**57* Construct an empty filter with no parent.58*/59public EventReaderDelegate(){}6061/**62* Construct an filter with the specified parent.63* @param reader the parent64*/65public EventReaderDelegate(XMLEventReader reader) {66this.reader = reader;67}6869/**70* Set the parent of this instance.71* @param reader the new parent72*/73public void setParent(XMLEventReader reader) {74this.reader = reader;75}7677/**78* Get the parent of this instance.79* @return the parent or null if none is set80*/81public XMLEventReader getParent() {82return reader;83}8485public XMLEvent nextEvent()86throws XMLStreamException87{88return reader.nextEvent();89}9091public Object next() {92return reader.next();93}9495public boolean hasNext()96{97return reader.hasNext();98}99100public XMLEvent peek()101throws XMLStreamException102{103return reader.peek();104}105106public void close()107throws XMLStreamException108{109reader.close();110}111112public String getElementText()113throws XMLStreamException114{115return reader.getElementText();116}117118public XMLEvent nextTag()119throws XMLStreamException120{121return reader.nextTag();122}123124public Object getProperty(java.lang.String name)125throws java.lang.IllegalArgumentException126{127return reader.getProperty(name);128}129130public void remove() {131reader.remove();132}133}134135136