src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/fastinfoset/stax/LowLevelFastInfosetStreamWriter.java

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

author
aoqi
date
Thu, 12 Oct 2017 19:44:07 +0800
changeset 760
e530533619ec
parent 0
373ffda63c9a
permissions
-rw-r--r--

merge

aoqi@0 1 /*
aoqi@0 2 * Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
aoqi@0 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
aoqi@0 4 *
aoqi@0 5 * This code is free software; you can redistribute it and/or modify it
aoqi@0 6 * under the terms of the GNU General Public License version 2 only, as
aoqi@0 7 * published by the Free Software Foundation. Oracle designates this
aoqi@0 8 * particular file as subject to the "Classpath" exception as provided
aoqi@0 9 * by Oracle in the LICENSE file that accompanied this code.
aoqi@0 10 *
aoqi@0 11 * This code is distributed in the hope that it will be useful, but WITHOUT
aoqi@0 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
aoqi@0 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
aoqi@0 14 * version 2 for more details (a copy is included in the LICENSE file that
aoqi@0 15 * accompanied this code).
aoqi@0 16 *
aoqi@0 17 * You should have received a copy of the GNU General Public License version
aoqi@0 18 * 2 along with this work; if not, write to the Free Software Foundation,
aoqi@0 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
aoqi@0 20 *
aoqi@0 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
aoqi@0 22 * or visit www.oracle.com if you need additional information or have any
aoqi@0 23 * questions.
aoqi@0 24 *
aoqi@0 25 * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC.
aoqi@0 26 */
aoqi@0 27
aoqi@0 28 package com.sun.xml.internal.org.jvnet.fastinfoset.stax;
aoqi@0 29
aoqi@0 30 import java.io.IOException;
aoqi@0 31 import javax.xml.stream.XMLStreamException;
aoqi@0 32
aoqi@0 33 /**
aoqi@0 34 * Low level Fast Infoset stream writer.
aoqi@0 35 * <p>
aoqi@0 36 * This interface provides additional stream-based serialization methods for the
aoqi@0 37 * case where an application is in specific control of the serialization
aoqi@0 38 * process and has the knowledge to call the LowLevel methods in the required
aoqi@0 39 * order.
aoqi@0 40 * <p>
aoqi@0 41 * For example, the application may be able to perform efficient information
aoqi@0 42 * to indexing mapping and to provide certain information in UTF-8 encoded form.
aoqi@0 43 * <p>
aoqi@0 44 * These methods may be used in conjuction with {@link javax.xml.stream.XMLStreamWriter}
aoqi@0 45 * as long as an element fragment written using the efficient streaming methods
aoqi@0 46 * are self-contained and no sub-fragment is written using methods from
aoqi@0 47 * {@link javax.xml.stream.XMLStreamWriter}.
aoqi@0 48 * <p>
aoqi@0 49 * The required call sequence is as follows:
aoqi@0 50 * <pre>
aoqi@0 51 * CALLSEQUENCE := {@link #startDocument startDocument}
aoqi@0 52 * initiateLowLevelWriting ELEMENT
aoqi@0 53 * {@link #endDocument endDocument}
aoqi@0 54 * | initiateLowLevelWriting ELEMENT // for fragment
aoqi@0 55 *
aoqi@0 56 * ELEMENT := writeLowLevelTerminationAndMark
aoqi@0 57 * NAMESPACES?
aoqi@0 58 * ELEMENT_NAME
aoqi@0 59 * ATTRIBUTES?
aoqi@0 60 * writeLowLevelEndStartElement
aoqi@0 61 * CONTENTS
aoqi@0 62 * writeLowLevelEndElement
aoqi@0 63 *
aoqi@0 64 * NAMESPACES := writeLowLevelStartNamespaces
aoqi@0 65 * writeLowLevelNamespace*
aoqi@0 66 * writeLowLevelEndNamespaces
aoqi@0 67 *
aoqi@0 68 * ELEMENT_NAME := writeLowLevelStartElementIndexed
aoqi@0 69 * | writeLowLevelStartNameLiteral
aoqi@0 70 * | writeLowLevelStartElement
aoqi@0 71 *
aoqi@0 72 * ATTRUBUTES := writeLowLevelStartAttributes
aoqi@0 73 * (ATTRIBUTE_NAME writeLowLevelAttributeValue)*
aoqi@0 74 *
aoqi@0 75 * ATTRIBUTE_NAME := writeLowLevelAttributeIndexed
aoqi@0 76 * | writeLowLevelStartNameLiteral
aoqi@0 77 * | writeLowLevelAttribute
aoqi@0 78 *
aoqi@0 79 *
aoqi@0 80 * CONTENTS := (ELEMENT | writeLowLevelText writeLowLevelOctets)*
aoqi@0 81 * </pre>
aoqi@0 82 * <p>
aoqi@0 83 * Some methods defer to the application for the mapping of information
aoqi@0 84 * to indexes.
aoqi@0 85 */
aoqi@0 86 public interface LowLevelFastInfosetStreamWriter {
aoqi@0 87 /**
aoqi@0 88 * Initiate low level writing of an element fragment.
aoqi@0 89 * <p>
aoqi@0 90 * This method must be invoked before other low level method.
aoqi@0 91 */
aoqi@0 92 public void initiateLowLevelWriting()
aoqi@0 93 throws XMLStreamException;
aoqi@0 94
aoqi@0 95 /**
aoqi@0 96 * Get the next index to apply to an Element Information Item.
aoqi@0 97 * <p>
aoqi@0 98 * This will increment the next obtained index such that:
aoqi@0 99 * <pre>
aoqi@0 100 * i = w.getNextElementIndex();
aoqi@0 101 * j = w.getNextElementIndex();
aoqi@0 102 * i == j + 1;
aoqi@0 103 * </pre>
aoqi@0 104 * @return the index.
aoqi@0 105 */
aoqi@0 106 public int getNextElementIndex();
aoqi@0 107
aoqi@0 108 /**
aoqi@0 109 * Get the next index to apply to an Attribute Information Item.
aoqi@0 110 * This will increment the next obtained index such that:
aoqi@0 111 * <pre>
aoqi@0 112 * i = w.getNextAttributeIndex();
aoqi@0 113 * j = w.getNextAttributeIndex();
aoqi@0 114 * i == j + 1;
aoqi@0 115 * </pre>
aoqi@0 116 * @return the index.
aoqi@0 117 */
aoqi@0 118 public int getNextAttributeIndex();
aoqi@0 119
aoqi@0 120 /**
aoqi@0 121 * Get the current index that was applied to an [local name] of an
aoqi@0 122 * Element or Attribute Information Item.
aoqi@0 123 * </pre>
aoqi@0 124 * @return the index.
aoqi@0 125 */
aoqi@0 126 public int getLocalNameIndex();
aoqi@0 127
aoqi@0 128 /**
aoqi@0 129 * Get the next index to apply to an [local name] of an Element or Attribute
aoqi@0 130 * Information Item.
aoqi@0 131 * This will increment the next obtained index such that:
aoqi@0 132 * <pre>
aoqi@0 133 * i = w.getNextLocalNameIndex();
aoqi@0 134 * j = w.getNextLocalNameIndex();
aoqi@0 135 * i == j + 1;
aoqi@0 136 * </pre>
aoqi@0 137 * @return the index.
aoqi@0 138 */
aoqi@0 139 public int getNextLocalNameIndex();
aoqi@0 140
aoqi@0 141 public void writeLowLevelTerminationAndMark()
aoqi@0 142 throws IOException;
aoqi@0 143
aoqi@0 144 public void writeLowLevelStartElementIndexed(int type, int index)
aoqi@0 145 throws IOException;
aoqi@0 146
aoqi@0 147 /**
aoqi@0 148 * Write the start of an element.
aoqi@0 149 *
aoqi@0 150 * @return true if element is indexed, otherwise false.
aoqi@0 151 */
aoqi@0 152 public boolean writeLowLevelStartElement(int type,
aoqi@0 153 String prefix, String localName, String namespaceURI)
aoqi@0 154 throws IOException;
aoqi@0 155
aoqi@0 156 public void writeLowLevelStartNamespaces()
aoqi@0 157 throws IOException;
aoqi@0 158
aoqi@0 159 public void writeLowLevelNamespace(String prefix, String namespaceName)
aoqi@0 160 throws IOException;
aoqi@0 161
aoqi@0 162 public void writeLowLevelEndNamespaces()
aoqi@0 163 throws IOException;
aoqi@0 164
aoqi@0 165 public void writeLowLevelStartAttributes()
aoqi@0 166 throws IOException;
aoqi@0 167
aoqi@0 168 public void writeLowLevelAttributeIndexed(int index)
aoqi@0 169 throws IOException;
aoqi@0 170
aoqi@0 171 /**
aoqi@0 172 * Write an attribute.
aoqi@0 173 *
aoqi@0 174 * @return true if attribute is indexed, otherwise false.
aoqi@0 175 */
aoqi@0 176 public boolean writeLowLevelAttribute(
aoqi@0 177 String prefix, String namespaceURI, String localName)
aoqi@0 178 throws IOException;
aoqi@0 179
aoqi@0 180 public void writeLowLevelAttributeValue(String value)
aoqi@0 181 throws IOException;
aoqi@0 182
aoqi@0 183 public void writeLowLevelStartNameLiteral(int type,
aoqi@0 184 String prefix, byte[] utf8LocalName, String namespaceURI)
aoqi@0 185 throws IOException;
aoqi@0 186
aoqi@0 187 public void writeLowLevelStartNameLiteral(int type,
aoqi@0 188 String prefix, int localNameIndex, String namespaceURI)
aoqi@0 189 throws IOException;
aoqi@0 190
aoqi@0 191 public void writeLowLevelEndStartElement()
aoqi@0 192 throws IOException;
aoqi@0 193
aoqi@0 194 public void writeLowLevelEndElement()
aoqi@0 195 throws IOException;
aoqi@0 196
aoqi@0 197 public void writeLowLevelText(char[] text, int length)
aoqi@0 198 throws IOException;
aoqi@0 199
aoqi@0 200 public void writeLowLevelText(String text)
aoqi@0 201 throws IOException;
aoqi@0 202
aoqi@0 203 public void writeLowLevelOctets(byte[] octets, int length)
aoqi@0 204 throws IOException;
aoqi@0 205 }

mercurial