src/share/jaxws_classes/com/sun/xml/internal/ws/util/xml/XMLStreamReaderFilter.java

Thu, 12 Oct 2017 19:44:07 +0800

author
aoqi
date
Thu, 12 Oct 2017 19:44:07 +0800
changeset 760
e530533619ec
parent 637
9c07ef4934dd
permissions
-rw-r--r--

merge

     1 /*
     2  * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     8  * particular file as subject to the "Classpath" exception as provided
     9  * by Oracle in the LICENSE file that accompanied this code.
    10  *
    11  * This code is distributed in the hope that it will be useful, but WITHOUT
    12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    14  * version 2 for more details (a copy is included in the LICENSE file that
    15  * accompanied this code).
    16  *
    17  * You should have received a copy of the GNU General Public License version
    18  * 2 along with this work; if not, write to the Free Software Foundation,
    19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    20  *
    21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    22  * or visit www.oracle.com if you need additional information or have any
    23  * questions.
    24  */
    26 package com.sun.xml.internal.ws.util.xml;
    28 import com.sun.xml.internal.ws.api.streaming.XMLStreamReaderFactory;
    30 import javax.xml.namespace.NamespaceContext;
    31 import javax.xml.namespace.QName;
    32 import javax.xml.stream.Location;
    33 import javax.xml.stream.XMLStreamException;
    34 import javax.xml.stream.XMLStreamReader;
    36 /**
    37  * {@link XMLStreamReader} that delegates to another {@link XMLStreamReader}.
    38  *
    39  * <p>
    40  * This class isn't very useful by itself, but works as a base class
    41  * for {@link XMLStreamReader} filtering.
    42  *
    43  * @author Kohsuke Kawaguchi
    44  */
    45 public class XMLStreamReaderFilter implements XMLStreamReaderFactory.RecycleAware, XMLStreamReader {
    46     /**
    47      * The underlying {@link XMLStreamReader} that does the parsing of the root part.
    48      */
    49     protected XMLStreamReader reader;
    51     public XMLStreamReaderFilter(XMLStreamReader core) {
    52         this.reader = core;
    53     }
    55     public void onRecycled() {
    56         XMLStreamReaderFactory.recycle(reader);
    57         reader = null;
    58     }
    60     public int getAttributeCount() {
    61         return reader.getAttributeCount();
    62     }
    64     public int getEventType() {
    65         return reader.getEventType();
    66     }
    68     public int getNamespaceCount() {
    69         return reader.getNamespaceCount();
    70     }
    72     public int getTextLength() {
    73         return reader.getTextLength();
    74     }
    76     public int getTextStart() {
    77         return reader.getTextStart();
    78     }
    80     public int next() throws XMLStreamException {
    81         return reader.next();
    82     }
    84     public int nextTag() throws XMLStreamException {
    85         return reader.nextTag();
    86     }
    88     public void close() throws XMLStreamException {
    89         reader.close();
    90     }
    92     public boolean hasName() {
    93         return reader.hasName();
    94     }
    96     public boolean hasNext() throws XMLStreamException {
    97         return reader.hasNext();
    98     }
   100     public boolean hasText() {
   101         return reader.hasText();
   102     }
   104     public boolean isCharacters() {
   105         return reader.isCharacters();
   106     }
   108     public boolean isEndElement() {
   109         return reader.isEndElement();
   110     }
   112     public boolean isStandalone() {
   113         return reader.isStandalone();
   114     }
   116     public boolean isStartElement() {
   117         return reader.isStartElement();
   118     }
   120     public boolean isWhiteSpace() {
   121         return reader.isWhiteSpace();
   122     }
   124     public boolean standaloneSet() {
   125         return reader.standaloneSet();
   126     }
   128     public char[] getTextCharacters() {
   129         return reader.getTextCharacters();
   130     }
   132     public boolean isAttributeSpecified(int index) {
   133         return reader.isAttributeSpecified(index);
   134     }
   136     public int getTextCharacters(int sourceStart, char[] target, int targetStart, int length) throws XMLStreamException {
   137         return reader.getTextCharacters(sourceStart, target, targetStart, length);
   138     }
   140     public String getCharacterEncodingScheme() {
   141         return reader.getCharacterEncodingScheme();
   142     }
   144     public String getElementText() throws XMLStreamException {
   145         return reader.getElementText();
   146     }
   148     public String getEncoding() {
   149         return reader.getEncoding();
   150     }
   152     public String getLocalName() {
   153         return reader.getLocalName();
   154     }
   156     public String getNamespaceURI() {
   157         return reader.getNamespaceURI();
   158     }
   160     public String getPIData() {
   161         return reader.getPIData();
   162     }
   164     public String getPITarget() {
   165         return reader.getPITarget();
   166     }
   168     public String getPrefix() {
   169         return reader.getPrefix();
   170     }
   172     public String getText() {
   173         return reader.getText();
   174     }
   176     public String getVersion() {
   177         return reader.getVersion();
   178     }
   180     public String getAttributeLocalName(int index) {
   181         return reader.getAttributeLocalName(index);
   182     }
   184     public String getAttributeNamespace(int index) {
   185         return reader.getAttributeNamespace(index);
   186     }
   188     public String getAttributePrefix(int index) {
   189         return reader.getAttributePrefix(index);
   190     }
   192     public String getAttributeType(int index) {
   193         return reader.getAttributeType(index);
   194     }
   196     public String getAttributeValue(int index) {
   197         return reader.getAttributeValue(index);
   198     }
   200     public String getNamespacePrefix(int index) {
   201         return reader.getNamespacePrefix(index);
   202     }
   204     public String getNamespaceURI(int index) {
   205         return reader.getNamespaceURI(index);
   206     }
   208     public NamespaceContext getNamespaceContext() {
   209         return reader.getNamespaceContext();
   210     }
   212     public QName getName() {
   213         return reader.getName();
   214     }
   216     public QName getAttributeName(int index) {
   217         return reader.getAttributeName(index);
   218     }
   220     public Location getLocation() {
   221         return reader.getLocation();
   222     }
   224     public Object getProperty(String name) throws IllegalArgumentException {
   225         return reader.getProperty(name);
   226     }
   228     public void require(int type, String namespaceURI, String localName) throws XMLStreamException {
   229         reader.require(type, namespaceURI, localName);
   230     }
   232     public String getNamespaceURI(String prefix) {
   233         return reader.getNamespaceURI(prefix);
   234     }
   236     public String getAttributeValue(String namespaceURI, String localName) {
   237         return reader.getAttributeValue(namespaceURI, localName);
   238     }
   239 }

mercurial