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

changeset 286
f50545b5e2f1
child 368
0989ad8c0860
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/share/jaxws_classes/com/sun/xml/internal/ws/util/xml/XMLStreamWriterFilter.java	Tue Mar 06 16:09:35 2012 -0800
     1.3 @@ -0,0 +1,183 @@
     1.4 +/*
     1.5 + * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
     1.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.7 + *
     1.8 + * This code is free software; you can redistribute it and/or modify it
     1.9 + * under the terms of the GNU General Public License version 2 only, as
    1.10 + * published by the Free Software Foundation.  Oracle designates this
    1.11 + * particular file as subject to the "Classpath" exception as provided
    1.12 + * by Oracle in the LICENSE file that accompanied this code.
    1.13 + *
    1.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
    1.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    1.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    1.17 + * version 2 for more details (a copy is included in the LICENSE file that
    1.18 + * accompanied this code).
    1.19 + *
    1.20 + * You should have received a copy of the GNU General Public License version
    1.21 + * 2 along with this work; if not, write to the Free Software Foundation,
    1.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    1.23 + *
    1.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    1.25 + * or visit www.oracle.com if you need additional information or have any
    1.26 + * questions.
    1.27 + */
    1.28 +
    1.29 +package com.sun.xml.internal.ws.util.xml;
    1.30 +
    1.31 +import com.sun.xml.internal.ws.api.streaming.XMLStreamWriterFactory;
    1.32 +import com.sun.xml.internal.ws.api.streaming.XMLStreamWriterFactory.RecycleAware;
    1.33 +
    1.34 +import javax.xml.namespace.NamespaceContext;
    1.35 +import javax.xml.stream.XMLStreamException;
    1.36 +import javax.xml.stream.XMLStreamWriter;
    1.37 +
    1.38 +/**
    1.39 + * {@link XMLStreamWriter} that delegates to another {@link XMLStreamWriter}.
    1.40 + *
    1.41 + * <p>
    1.42 + * This class isn't very useful by itself, but works as a base class
    1.43 + * for {@link XMLStreamWriter} filtering.
    1.44 + *
    1.45 + * @author Kohsuke Kawaguchi
    1.46 + */
    1.47 +public class XMLStreamWriterFilter implements XMLStreamWriter, RecycleAware {
    1.48 +    protected XMLStreamWriter writer;
    1.49 +
    1.50 +    public XMLStreamWriterFilter(XMLStreamWriter writer) {
    1.51 +        this.writer = writer;
    1.52 +    }
    1.53 +
    1.54 +    public void close() throws XMLStreamException {
    1.55 +        writer.close();
    1.56 +    }
    1.57 +
    1.58 +    public void flush() throws XMLStreamException {
    1.59 +        writer.flush();
    1.60 +    }
    1.61 +
    1.62 +    public void writeEndDocument() throws XMLStreamException {
    1.63 +        writer.writeEndDocument();
    1.64 +    }
    1.65 +
    1.66 +    public void writeEndElement() throws XMLStreamException {
    1.67 +        writer.writeEndElement();
    1.68 +    }
    1.69 +
    1.70 +    public void writeStartDocument() throws XMLStreamException {
    1.71 +        writer.writeStartDocument();
    1.72 +    }
    1.73 +
    1.74 +    public void writeCharacters(char[] text, int start, int len) throws XMLStreamException {
    1.75 +        writer.writeCharacters(text, start, len);
    1.76 +    }
    1.77 +
    1.78 +    public void setDefaultNamespace(String uri) throws XMLStreamException {
    1.79 +        writer.setDefaultNamespace(uri);
    1.80 +    }
    1.81 +
    1.82 +    public void writeCData(String data) throws XMLStreamException {
    1.83 +        writer.writeCData(data);
    1.84 +    }
    1.85 +
    1.86 +    public void writeCharacters(String text) throws XMLStreamException {
    1.87 +        writer.writeCharacters(text);
    1.88 +    }
    1.89 +
    1.90 +    public void writeComment(String data) throws XMLStreamException {
    1.91 +        writer.writeComment(data);
    1.92 +    }
    1.93 +
    1.94 +    public void writeDTD(String dtd) throws XMLStreamException {
    1.95 +        writer.writeDTD(dtd);
    1.96 +    }
    1.97 +
    1.98 +    public void writeDefaultNamespace(String namespaceURI) throws XMLStreamException {
    1.99 +        writer.writeDefaultNamespace(namespaceURI);
   1.100 +    }
   1.101 +
   1.102 +    public void writeEmptyElement(String localName) throws XMLStreamException {
   1.103 +        writer.writeEmptyElement(localName);
   1.104 +    }
   1.105 +
   1.106 +    public void writeEntityRef(String name) throws XMLStreamException {
   1.107 +        writer.writeEntityRef(name);
   1.108 +    }
   1.109 +
   1.110 +    public void writeProcessingInstruction(String target) throws XMLStreamException {
   1.111 +        writer.writeProcessingInstruction(target);
   1.112 +    }
   1.113 +
   1.114 +    public void writeStartDocument(String version) throws XMLStreamException {
   1.115 +        writer.writeStartDocument(version);
   1.116 +    }
   1.117 +
   1.118 +    public void writeStartElement(String localName) throws XMLStreamException {
   1.119 +        writer.writeStartElement(localName);
   1.120 +    }
   1.121 +
   1.122 +    public NamespaceContext getNamespaceContext() {
   1.123 +        return writer.getNamespaceContext();
   1.124 +    }
   1.125 +
   1.126 +    public void setNamespaceContext(NamespaceContext context) throws XMLStreamException {
   1.127 +        writer.setNamespaceContext(context);
   1.128 +    }
   1.129 +
   1.130 +    public Object getProperty(String name) throws IllegalArgumentException {
   1.131 +        return writer.getProperty(name);
   1.132 +    }
   1.133 +
   1.134 +    public String getPrefix(String uri) throws XMLStreamException {
   1.135 +        return writer.getPrefix(uri);
   1.136 +    }
   1.137 +
   1.138 +    public void setPrefix(String prefix, String uri) throws XMLStreamException {
   1.139 +        writer.setPrefix(prefix, uri);
   1.140 +    }
   1.141 +
   1.142 +    public void writeAttribute(String localName, String value) throws XMLStreamException {
   1.143 +        writer.writeAttribute(localName, value);
   1.144 +    }
   1.145 +
   1.146 +    public void writeEmptyElement(String namespaceURI, String localName) throws XMLStreamException {
   1.147 +        writer.writeEmptyElement(namespaceURI, localName);
   1.148 +    }
   1.149 +
   1.150 +    public void writeNamespace(String prefix, String namespaceURI) throws XMLStreamException {
   1.151 +        writer.writeNamespace(prefix, namespaceURI);
   1.152 +    }
   1.153 +
   1.154 +    public void writeProcessingInstruction(String target, String data) throws XMLStreamException {
   1.155 +        writer.writeProcessingInstruction(target, data);
   1.156 +    }
   1.157 +
   1.158 +    public void writeStartDocument(String encoding, String version) throws XMLStreamException {
   1.159 +        writer.writeStartDocument(encoding, version);
   1.160 +    }
   1.161 +
   1.162 +    public void writeStartElement(String namespaceURI, String localName) throws XMLStreamException {
   1.163 +        writer.writeStartElement(namespaceURI, localName);
   1.164 +    }
   1.165 +
   1.166 +    public void writeAttribute(String namespaceURI, String localName, String value) throws XMLStreamException {
   1.167 +        writer.writeAttribute(namespaceURI, localName, value);
   1.168 +    }
   1.169 +
   1.170 +    public void writeEmptyElement(String prefix, String localName, String namespaceURI) throws XMLStreamException {
   1.171 +        writer.writeEmptyElement(prefix, localName, namespaceURI);
   1.172 +    }
   1.173 +
   1.174 +    public void writeStartElement(String prefix, String localName, String namespaceURI) throws XMLStreamException {
   1.175 +        writer.writeStartElement(prefix, localName, namespaceURI);
   1.176 +    }
   1.177 +
   1.178 +    public void writeAttribute(String prefix, String namespaceURI, String localName, String value) throws XMLStreamException {
   1.179 +        writer.writeAttribute(prefix, namespaceURI, localName, value);
   1.180 +    }
   1.181 +
   1.182 +    public void onRecycled() {
   1.183 +        XMLStreamWriterFactory.recycle(writer);
   1.184 +        writer = null;
   1.185 +    }
   1.186 +}

mercurial