Path: blob/aarch64-shenandoah-jdk8u272-b10/jaxp/src/javax/xml/stream/util/StreamReaderDelegate.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 java.io.Reader;31import javax.xml.namespace.QName;32import javax.xml.namespace.NamespaceContext;33import javax.xml.stream.XMLStreamReader;34import javax.xml.stream.Location;35import javax.xml.stream.XMLStreamException;3637/**38* This is the base class for deriving an XMLStreamReader filter39*40* This class is designed to sit between an XMLStreamReader and an41* application's XMLStreamReader. By default each method42* does nothing but call the corresponding method on the43* parent interface.44*45* @version 1.046* @author Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.47* @see javax.xml.stream.XMLStreamReader48* @see EventReaderDelegate49* @since 1.650*/5152public class StreamReaderDelegate implements XMLStreamReader {53private XMLStreamReader reader;5455/**56* Construct an empty filter with no parent.57*/58public StreamReaderDelegate(){}5960/**61* Construct an filter with the specified parent.62* @param reader the parent63*/64public StreamReaderDelegate(XMLStreamReader reader) {65this.reader = reader;66}6768/**69* Set the parent of this instance.70* @param reader the new parent71*/72public void setParent(XMLStreamReader reader) {73this.reader = reader;74}7576/**77* Get the parent of this instance.78* @return the parent or null if none is set79*/80public XMLStreamReader getParent() {81return reader;82}8384public int next()85throws XMLStreamException86{87return reader.next();88}8990public int nextTag()91throws XMLStreamException92{93return reader.nextTag();94}9596public String getElementText()97throws XMLStreamException98{99return reader.getElementText();100}101102public void require(int type, String namespaceURI, String localName)103throws XMLStreamException104{105reader.require(type,namespaceURI,localName);106}107108public boolean hasNext()109throws XMLStreamException110{111return reader.hasNext();112}113114public void close()115throws XMLStreamException116{117reader.close();118}119120public String getNamespaceURI(String prefix)121{122return reader.getNamespaceURI(prefix);123}124125public NamespaceContext getNamespaceContext() {126return reader.getNamespaceContext();127}128129public boolean isStartElement() {130return reader.isStartElement();131}132133public boolean isEndElement() {134return reader.isEndElement();135}136137public boolean isCharacters() {138return reader.isCharacters();139}140141public boolean isWhiteSpace() {142return reader.isWhiteSpace();143}144145public String getAttributeValue(String namespaceUri,146String localName)147{148return reader.getAttributeValue(namespaceUri,localName);149}150151public int getAttributeCount() {152return reader.getAttributeCount();153}154155public QName getAttributeName(int index) {156return reader.getAttributeName(index);157}158159public String getAttributePrefix(int index) {160return reader.getAttributePrefix(index);161}162163public String getAttributeNamespace(int index) {164return reader.getAttributeNamespace(index);165}166167public String getAttributeLocalName(int index) {168return reader.getAttributeLocalName(index);169}170171public String getAttributeType(int index) {172return reader.getAttributeType(index);173}174175public String getAttributeValue(int index) {176return reader.getAttributeValue(index);177}178179public boolean isAttributeSpecified(int index) {180return reader.isAttributeSpecified(index);181}182183public int getNamespaceCount() {184return reader.getNamespaceCount();185}186187public String getNamespacePrefix(int index) {188return reader.getNamespacePrefix(index);189}190191public String getNamespaceURI(int index) {192return reader.getNamespaceURI(index);193}194195public int getEventType() {196return reader.getEventType();197}198199public String getText() {200return reader.getText();201}202203public int getTextCharacters(int sourceStart,204char[] target,205int targetStart,206int length)207throws XMLStreamException {208return reader.getTextCharacters(sourceStart,209target,210targetStart,211length);212}213214215public char[] getTextCharacters() {216return reader.getTextCharacters();217}218219public int getTextStart() {220return reader.getTextStart();221}222223public int getTextLength() {224return reader.getTextLength();225}226227public String getEncoding() {228return reader.getEncoding();229}230231public boolean hasText() {232return reader.hasText();233}234235public Location getLocation() {236return reader.getLocation();237}238239public QName getName() {240return reader.getName();241}242243public String getLocalName() {244return reader.getLocalName();245}246247public boolean hasName() {248return reader.hasName();249}250251public String getNamespaceURI() {252return reader.getNamespaceURI();253}254255public String getPrefix() {256return reader.getPrefix();257}258259public String getVersion() {260return reader.getVersion();261}262263public boolean isStandalone() {264return reader.isStandalone();265}266267public boolean standaloneSet() {268return reader.standaloneSet();269}270271public String getCharacterEncodingScheme() {272return reader.getCharacterEncodingScheme();273}274275public String getPITarget() {276return reader.getPITarget();277}278279public String getPIData() {280return reader.getPIData();281}282283public Object getProperty(String name) {284return reader.getProperty(name);285}286}287288289