286N/A/*
286N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
286N/A *
286N/A * This code is free software; you can redistribute it and/or modify it
286N/A * under the terms of the GNU General Public License version 2 only, as
286N/A * published by the Free Software Foundation. Oracle designates this
286N/A * particular file as subject to the "Classpath" exception as provided
286N/A * by Oracle in the LICENSE file that accompanied this code.
286N/A *
286N/A * This code is distributed in the hope that it will be useful, but WITHOUT
286N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
286N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
286N/A * version 2 for more details (a copy is included in the LICENSE file that
286N/A * accompanied this code).
286N/A *
286N/A * You should have received a copy of the GNU General Public License version
286N/A * 2 along with this work; if not, write to the Free Software Foundation,
286N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
286N/A *
286N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
286N/A * or visit www.oracle.com if you need additional information or have any
286N/A * questions.
286N/A */
286N/A
286N/A/*
286N/A * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
286N/A */
286N/A
286N/Apackage javax.xml.stream.util;
286N/A
286N/Aimport java.io.Reader;
286N/Aimport javax.xml.namespace.QName;
286N/Aimport javax.xml.namespace.NamespaceContext;
286N/Aimport javax.xml.stream.XMLStreamReader;
286N/Aimport javax.xml.stream.Location;
286N/Aimport javax.xml.stream.XMLStreamException;
286N/A
286N/A/**
286N/A * This is the base class for deriving an XMLStreamReader filter
286N/A *
286N/A * This class is designed to sit between an XMLStreamReader and an
286N/A * application's XMLStreamReader. By default each method
286N/A * does nothing but call the corresponding method on the
286N/A * parent interface.
286N/A *
286N/A * @version 1.0
286N/A * @author Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
286N/A * @see javax.xml.stream.XMLStreamReader
286N/A * @see EventReaderDelegate
286N/A * @since 1.6
286N/A */
286N/A
286N/Apublic class StreamReaderDelegate implements XMLStreamReader {
286N/A private XMLStreamReader reader;
286N/A
286N/A /**
286N/A * Construct an empty filter with no parent.
286N/A */
286N/A public StreamReaderDelegate(){}
286N/A
286N/A /**
286N/A * Construct an filter with the specified parent.
286N/A * @param reader the parent
286N/A */
286N/A public StreamReaderDelegate(XMLStreamReader reader) {
286N/A this.reader = reader;
286N/A }
286N/A
286N/A /**
286N/A * Set the parent of this instance.
286N/A * @param reader the new parent
286N/A */
286N/A public void setParent(XMLStreamReader reader) {
286N/A this.reader = reader;
286N/A }
286N/A
286N/A /**
286N/A * Get the parent of this instance.
286N/A * @return the parent or null if none is set
286N/A */
286N/A public XMLStreamReader getParent() {
286N/A return reader;
286N/A }
286N/A
286N/A public int next()
286N/A throws XMLStreamException
286N/A {
286N/A return reader.next();
286N/A }
286N/A
286N/A public int nextTag()
286N/A throws XMLStreamException
286N/A {
286N/A return reader.nextTag();
286N/A }
286N/A
286N/A public String getElementText()
286N/A throws XMLStreamException
286N/A {
286N/A return reader.getElementText();
286N/A }
286N/A
286N/A public void require(int type, String namespaceURI, String localName)
286N/A throws XMLStreamException
286N/A {
286N/A reader.require(type,namespaceURI,localName);
286N/A }
286N/A
286N/A public boolean hasNext()
286N/A throws XMLStreamException
286N/A {
286N/A return reader.hasNext();
286N/A }
286N/A
286N/A public void close()
286N/A throws XMLStreamException
286N/A {
286N/A reader.close();
286N/A }
286N/A
286N/A public String getNamespaceURI(String prefix)
286N/A {
286N/A return reader.getNamespaceURI(prefix);
286N/A }
286N/A
286N/A public NamespaceContext getNamespaceContext() {
286N/A return reader.getNamespaceContext();
286N/A }
286N/A
286N/A public boolean isStartElement() {
286N/A return reader.isStartElement();
286N/A }
286N/A
286N/A public boolean isEndElement() {
286N/A return reader.isEndElement();
286N/A }
286N/A
286N/A public boolean isCharacters() {
286N/A return reader.isCharacters();
286N/A }
286N/A
286N/A public boolean isWhiteSpace() {
286N/A return reader.isWhiteSpace();
286N/A }
286N/A
286N/A public String getAttributeValue(String namespaceUri,
286N/A String localName)
286N/A {
286N/A return reader.getAttributeValue(namespaceUri,localName);
286N/A }
286N/A
286N/A public int getAttributeCount() {
286N/A return reader.getAttributeCount();
286N/A }
286N/A
286N/A public QName getAttributeName(int index) {
286N/A return reader.getAttributeName(index);
286N/A }
286N/A
286N/A public String getAttributePrefix(int index) {
286N/A return reader.getAttributePrefix(index);
286N/A }
286N/A
286N/A public String getAttributeNamespace(int index) {
286N/A return reader.getAttributeNamespace(index);
286N/A }
286N/A
286N/A public String getAttributeLocalName(int index) {
286N/A return reader.getAttributeLocalName(index);
286N/A }
286N/A
286N/A public String getAttributeType(int index) {
286N/A return reader.getAttributeType(index);
286N/A }
286N/A
286N/A public String getAttributeValue(int index) {
286N/A return reader.getAttributeValue(index);
286N/A }
286N/A
286N/A public boolean isAttributeSpecified(int index) {
286N/A return reader.isAttributeSpecified(index);
286N/A }
286N/A
286N/A public int getNamespaceCount() {
286N/A return reader.getNamespaceCount();
286N/A }
286N/A
286N/A public String getNamespacePrefix(int index) {
286N/A return reader.getNamespacePrefix(index);
286N/A }
286N/A
286N/A public String getNamespaceURI(int index) {
286N/A return reader.getNamespaceURI(index);
286N/A }
286N/A
286N/A public int getEventType() {
286N/A return reader.getEventType();
286N/A }
286N/A
286N/A public String getText() {
286N/A return reader.getText();
286N/A }
286N/A
286N/A public int getTextCharacters(int sourceStart,
286N/A char[] target,
286N/A int targetStart,
286N/A int length)
286N/A throws XMLStreamException {
286N/A return reader.getTextCharacters(sourceStart,
286N/A target,
286N/A targetStart,
286N/A length);
286N/A }
286N/A
286N/A
286N/A public char[] getTextCharacters() {
286N/A return reader.getTextCharacters();
286N/A }
286N/A
286N/A public int getTextStart() {
286N/A return reader.getTextStart();
286N/A }
286N/A
286N/A public int getTextLength() {
286N/A return reader.getTextLength();
286N/A }
286N/A
286N/A public String getEncoding() {
286N/A return reader.getEncoding();
286N/A }
286N/A
286N/A public boolean hasText() {
286N/A return reader.hasText();
286N/A }
286N/A
286N/A public Location getLocation() {
286N/A return reader.getLocation();
286N/A }
286N/A
286N/A public QName getName() {
286N/A return reader.getName();
286N/A }
286N/A
286N/A public String getLocalName() {
286N/A return reader.getLocalName();
286N/A }
286N/A
286N/A public boolean hasName() {
286N/A return reader.hasName();
286N/A }
286N/A
286N/A public String getNamespaceURI() {
286N/A return reader.getNamespaceURI();
286N/A }
286N/A
286N/A public String getPrefix() {
286N/A return reader.getPrefix();
286N/A }
286N/A
286N/A public String getVersion() {
286N/A return reader.getVersion();
286N/A }
286N/A
286N/A public boolean isStandalone() {
286N/A return reader.isStandalone();
286N/A }
286N/A
286N/A public boolean standaloneSet() {
286N/A return reader.standaloneSet();
286N/A }
286N/A
286N/A public String getCharacterEncodingScheme() {
286N/A return reader.getCharacterEncodingScheme();
286N/A }
286N/A
286N/A public String getPITarget() {
286N/A return reader.getPITarget();
286N/A }
286N/A
286N/A public String getPIData() {
286N/A return reader.getPIData();
286N/A }
286N/A
286N/A public Object getProperty(String name) {
286N/A return reader.getProperty(name);
286N/A }
286N/A}