1 /* 2 * Copyright (c) 2004, 2011, 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 * 25 * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. 26 */ 27 28 package com.sun.xml.internal.org.jvnet.fastinfoset.sax; 29 30 import org.xml.sax.SAXException; 31 32 /** 33 * SAX2 extention handler to receive notification of character data as 34 * primtive types. 35 * 36 * <p>This is an optional extension handler for SAX2. XML readers are not 37 * required to recognize this handler, and it is not part of core-only 38 * SAX2 distributions.</p> 39 * 40 * <p>This interface may be used with with a Fast Infoset 41 * SAX parser to receive notification of data encoded using the 42 * following built-in encoding algorithms specified in ITU-T Rec. X.891 | ISO/IEC 24824-1 43 * (Fast Infoset), clause 10: "boolean", "base64", "short", "int", "long", 44 * "float", "double" and "uuid" encoding algorithms.<p> 45 * 46 * <p>To set the PrimitiveTypeContentHandler for an XML reader, use the 47 * {@link org.xml.sax.XMLReader#setProperty setProperty} method 48 * with the property name 49 * <code>URI TO BE DEFINED</code> 50 * and an object implementing this interface (or null) as the value. 51 * If the reader does not report primitive data types, it will throw a 52 * {@link org.xml.sax.SAXNotRecognizedException SAXNotRecognizedException}</p> 53 * 54 * <p>To set the PrimitiveTypeContentHandler for an Fast Infoset reader, use 55 * {@link com.sun.xml.internal.org.jvnet.fastinfoset.sax.FastInfosetReader#setPrimitiveTypeContentHandler 56 * setPrimitiveTypeContentHandler} method.<p> 57 58 * <p>The Parser will call methods of this interface to report each 59 * chunk of character data that has been converted to an array of primitive 60 * types, for example an array of integer or an array of float. Parsers may 61 * return all contiguous primtive types in a single chunk, or they may split 62 * it into several chunks</p> 63 * 64 * <p>The application must not attempt to read from the array 65 * outside of the specified range.</p> 66 * 67 * @see com.sun.xml.internal.org.jvnet.fastinfoset.sax.EncodingAlgorithmContentHandler 68 * @see com.sun.xml.internal.org.jvnet.fastinfoset.sax.FastInfosetReader 69 * @see org.xml.sax.XMLReader 70 */ 71 public interface PrimitiveTypeContentHandler { 72 /** 73 * Receive notification of character data as an array of boolean. 74 * 75 * <p>The application must not attempt to read from the array 76 * outside of the specified range.</p> 77 * 78 * <p>Such notifications will occur for a Fast Infoset SAX parser 79 * when processing data encoded using the "boolean" encoding 80 * algorithm, see subclause 10.7<p>. 81 * 82 * @param b the array of boolean 83 * @param start the start position in the array 84 * @param length the number of boolean to read from the array 85 * @throws org.xml.sax.SAXException any SAX exception, possibly 86 * wrapping another exception 87 */ booleans(boolean [] b, int start, int length)88 public void booleans(boolean [] b, int start, int length) throws SAXException; 89 90 /** 91 * Receive notification of character data as an array of byte. 92 * 93 * <p>The application must not attempt to read from the array 94 * outside of the specified range.</p> 95 * 96 * <p>Such notifications will occur for a Fast Infoset SAX parser 97 * when processing data encoded using the "base64" encoding 98 * algorithm, see subclause 10.3, or the "hexadecimal" encoding 99 * algorithm, see subclause 10.2. 100 * 101 * <p>Such a notification may occur for binary data that would 102 * normally require base 64 encoding and reported as character data 103 * using the {@link org.xml.sax.ContentHandler#characters characters} 104 * method <p>. 105 * 106 * @param b the array of byte 107 * @param start the start position in the array 108 * @param length the number of byte to read from the array 109 * @throws org.xml.sax.SAXException any SAX exception, possibly 110 * wrapping another exception 111 */ bytes(byte[] b, int start, int length)112 public void bytes(byte[] b, int start, int length) throws SAXException; 113 114 /** 115 * Receive notification of character data as an array of short. 116 * 117 * <p>The application must not attempt to read from the array 118 * outside of the specified range.</p> 119 * 120 * <p>Such notifications will occur for a Fast Infoset SAX parser 121 * when processing data encoded using the "short" encoding 122 * algorithm, see subclause 10.4<p>. 123 * 124 * @param s the array of short 125 * @param start the start position in the array 126 * @param length the number of short to read from the array 127 * @throws org.xml.sax.SAXException any SAX exception, possibly 128 * wrapping another exception 129 */ shorts(short[] s, int start, int length)130 public void shorts(short[] s, int start, int length) throws SAXException; 131 132 /** 133 * Receive notification of character data as an array of int. 134 * 135 * <p>The application must not attempt to read from the array 136 * outside of the specified range.</p> 137 * 138 * <p>Such notifications will occur for a Fast Infoset SAX parser 139 * when processing data encoded using the "int" encoding 140 * algorithm, see subclause 10.5<p>. 141 * 142 * @param i the array of int 143 * @param start the start position in the array 144 * @param length the number of int to read from the array 145 * @throws org.xml.sax.SAXException any SAX exception, possibly 146 * wrapping another exception 147 */ ints(int [] i, int start, int length)148 public void ints(int [] i, int start, int length) throws SAXException; 149 150 /** 151 * Receive notification of character data as an array of long. 152 * 153 * <p>The application must not attempt to read from the array 154 * outside of the specified range.</p> 155 * 156 * <p>Such notifications will occur for a Fast Infoset SAX parser 157 * when processing data encoded using the "long" encoding 158 * algorithm, see subclause 10.6<p>. 159 * 160 * @param l the array of long 161 * @param start the start position in the array 162 * @param length the number of long to read from the array 163 * @throws org.xml.sax.SAXException any SAX exception, possibly 164 * wrapping another exception 165 */ longs(long [] l, int start, int length)166 public void longs(long [] l, int start, int length) throws SAXException; 167 168 /** 169 * Receive notification of character data as an array of float. 170 * 171 * <p>The application must not attempt to read from the array 172 * outside of the specified range.</p> 173 * 174 * <p>Such notifications will occur for a Fast Infoset SAX parser 175 * when processing data encoded using the "float" encoding 176 * algorithm, see subclause 10.8<p>. 177 * 178 * @param f the array of float 179 * @param start the start position in the array 180 * @param length the number of float to read from the array 181 * @throws org.xml.sax.SAXException any SAX exception, possibly 182 * wrapping another exception 183 */ floats(float [] f, int start, int length)184 public void floats(float [] f, int start, int length) throws SAXException; 185 186 /** 187 * Receive notification of character data as an array of double. 188 * 189 * <p>The application must not attempt to read from the array 190 * outside of the specified range.</p> 191 * 192 * <p>Such notifications will occur for a Fast Infoset SAX parser 193 * when processing data encoded using the "double" encoding 194 * algorithm, see subclause 10.9<p>. 195 * 196 * @param d the array of double 197 * @param start the start position in the array 198 * @param length the number of double to read from the array 199 * @throws org.xml.sax.SAXException any SAX exception, possibly 200 * wrapping another exception 201 */ doubles(double [] d, int start, int length)202 public void doubles(double [] d, int start, int length) throws SAXException; 203 204 /** 205 * Receive notification of character data as an two array of UUID. 206 * 207 * <p>The application must not attempt to read from the array 208 * outside of the specified range.</p> 209 * 210 * <p>Such notifications will occur for a Fast Infoset SAX parser 211 * when processing data encoded using the "uuid" encoding 212 * algorithm, see subclause 10.10<p>. 213 * 214 * @param msblsb the array of long containing pairs of most signficant 215 * bits and least significant bits of the UUIDs 216 * @param start the start position in the array 217 * @param length the number of long to read from the array. This will 218 * be twice the number of UUIDs, which are pairs of two long values 219 * @throws org.xml.sax.SAXException any SAX exception, possibly 220 * wrapping another exception 221 */ uuids(long[] msblsb, int start, int length)222 public void uuids(long[] msblsb, int start, int length) throws SAXException; 223 } 224