KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jvnet > fastinfoset > sax > PrimitiveTypeContentHandler


1 /*
2  * Fast Infoset ver. 0.1 software ("Software")
3  *
4  * Copyright, 2004-2005 Sun Microsystems, Inc. All Rights Reserved.
5  *
6  * Software is licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License. You may
8  * obtain a copy of the License at:
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
15  * License for the specific language governing permissions and limitations.
16  *
17  * Sun supports and benefits from the global community of open source
18  * developers, and thanks the community for its important contributions and
19  * open standards-based technology, which Sun has adopted into many of its
20  * products.
21  *
22  * Please note that portions of Software may be provided with notices and
23  * open source licenses from such communities and third parties that govern the
24  * use of those portions, and any licenses granted hereunder do not alter any
25  * rights and obligations you may have under such open source licenses,
26  * however, the disclaimer of warranty and limitation of liability provisions
27  * in this License will apply to all Software in this distribution.
28  *
29  * You acknowledge that the Software is not designed, licensed or intended
30  * for use in the design, construction, operation or maintenance of any nuclear
31  * facility.
32  *
33  * Apache License
34  * Version 2.0, January 2004
35  * http://www.apache.org/licenses/
36  *
37  */

38
39 package org.jvnet.fastinfoset.sax;
40
41 import org.xml.sax.SAXException JavaDoc;
42
43 /**
44  * SAX2 extention handler to receive notification of character data as
45  * primtive types.
46  *
47  * <p>This is an optional extension handler for SAX2. XML readers are not
48  * required to recognize this handler, and it is not part of core-only
49  * SAX2 distributions.</p>
50  *
51  * <p>This interface may be used with with a Fast Infoset
52  * SAX parser to receive notification of data encoded using the
53  * following built-in encoding algorithms specified in ITU-T Rec. X.891 | ISO/IEC 24824-1
54  * (Fast Infoset), clause 10: "boolean", "base64", "short", "int", "long",
55  * "float", "double" and "uuid" encoding algorithms.<p>
56  *
57  * <p>To set the PrimitiveTypeContentHandler for an XML reader, use the
58  * {@link org.xml.sax.XMLReader#setProperty setProperty} method
59  * with the property name
60  * <code>URI TO BE DEFINED</code>
61  * and an object implementing this interface (or null) as the value.
62  * If the reader does not report primitive data types, it will throw a
63  * {@link org.xml.sax.SAXNotRecognizedException SAXNotRecognizedException}</p>
64  *
65  * <p>To set the PrimitiveTypeContentHandler for an Fast Infoset reader, use
66  * {@link org.jvnet.fastinfoset.sax.FastInfosetReader#setPrimitiveTypeContentHandler
67  * setPrimitiveTypeContentHandler} method.<p>
68
69  * <p>The Parser will call methods of this interface to report each
70  * chunk of character data that has been converted to an array of primitive
71  * types, for example an array of integer or an array of float. Parsers may
72  * return all contiguous primtive types in a single chunk, or they may split
73  * it into several chunks</p>
74  *
75  * <p>The application must not attempt to read from the array
76  * outside of the specified range.</p>
77  * @version 0.1
78  * @see org.jvnet.fastinfoset.sax.EncodingAlgorithmContentHandler
79  * @see org.jvnet.fastinfoset.sax.FastInfosetReader
80  * @see org.xml.sax.XMLReader
81  */

82 public interface PrimitiveTypeContentHandler {
83     /**
84      * Receive notification of character data as an array of boolean.
85      *
86      * <p>The application must not attempt to read from the array
87      * outside of the specified range.</p>
88      *
89      * <p>Such notifications will occur for a Fast Infoset SAX parser
90      * when processing data encoded using the "boolean" encoding
91      * algorithm, see subclause 10.7<p>.
92      *
93      * @param b the array of boolean
94      * @param start the start position in the array
95      * @param length the number of boolean to read from the array
96      * @throws org.xml.sax.SAXException any SAX exception, possibly
97      * wrapping another exception
98      */

99     public void booleans(boolean [] b, int start, int length) throws SAXException JavaDoc;
100
101     /**
102      * Receive notification of character data as an array of byte.
103      *
104      * <p>The application must not attempt to read from the array
105      * outside of the specified range.</p>
106      *
107      * <p>Such notifications will occur for a Fast Infoset SAX parser
108      * when processing data encoded using the "base64" encoding
109      * algorithm, see subclause 10.3, or the "hexadecimal" encoding
110      * algorithm, see subclause 10.2.
111      *
112      * <p>Such a notification may occur for binary data that would
113      * normally require base 64 encoding and reported as character data
114      * using the {@link org.xml.sax.ContentHandler#characters characters}
115      * method <p>.
116      *
117      * @param b the array of byte
118      * @param start the start position in the array
119      * @param length the number of byte to read from the array
120      * @throws org.xml.sax.SAXException any SAX exception, possibly
121      * wrapping another exception
122      */

123     public void bytes(byte[] b, int start, int length) throws SAXException JavaDoc;
124     
125     /**
126      * Receive notification of character data as an array of short.
127      *
128      * <p>The application must not attempt to read from the array
129      * outside of the specified range.</p>
130      *
131      * <p>Such notifications will occur for a Fast Infoset SAX parser
132      * when processing data encoded using the "short" encoding
133      * algorithm, see subclause 10.4<p>.
134      *
135      * @param s the array of short
136      * @param start the start position in the array
137      * @param length the number of short to read from the array
138      * @throws org.xml.sax.SAXException any SAX exception, possibly
139      * wrapping another exception
140      */

141     public void shorts(short[] s, int start, int length) throws SAXException JavaDoc;
142     
143     /**
144      * Receive notification of character data as an array of int.
145      *
146      * <p>The application must not attempt to read from the array
147      * outside of the specified range.</p>
148      *
149      * <p>Such notifications will occur for a Fast Infoset SAX parser
150      * when processing data encoded using the "int" encoding
151      * algorithm, see subclause 10.5<p>.
152      *
153      * @param i the array of int
154      * @param start the start position in the array
155      * @param length the number of int to read from the array
156      * @throws org.xml.sax.SAXException any SAX exception, possibly
157      * wrapping another exception
158      */

159     public void ints(int [] i, int start, int length) throws SAXException JavaDoc;
160     
161     /**
162      * Receive notification of character data as an array of long.
163      *
164      * <p>The application must not attempt to read from the array
165      * outside of the specified range.</p>
166      *
167      * <p>Such notifications will occur for a Fast Infoset SAX parser
168      * when processing data encoded using the "long" encoding
169      * algorithm, see subclause 10.6<p>.
170      *
171      * @param l the array of long
172      * @param start the start position in the array
173      * @param length the number of long to read from the array
174      * @throws org.xml.sax.SAXException any SAX exception, possibly
175      * wrapping another exception
176      */

177     public void longs(long [] l, int start, int length) throws SAXException JavaDoc;
178     
179     /**
180      * Receive notification of character data as an array of float.
181      *
182      * <p>The application must not attempt to read from the array
183      * outside of the specified range.</p>
184      *
185      * <p>Such notifications will occur for a Fast Infoset SAX parser
186      * when processing data encoded using the "float" encoding
187      * algorithm, see subclause 10.8<p>.
188      *
189      * @param f the array of float
190      * @param start the start position in the array
191      * @param length the number of float to read from the array
192      * @throws org.xml.sax.SAXException any SAX exception, possibly
193      * wrapping another exception
194      */

195     public void floats(float [] f, int start, int length) throws SAXException JavaDoc;
196     
197     /**
198      * Receive notification of character data as an array of double.
199      *
200      * <p>The application must not attempt to read from the array
201      * outside of the specified range.</p>
202      *
203      * <p>Such notifications will occur for a Fast Infoset SAX parser
204      * when processing data encoded using the "double" encoding
205      * algorithm, see subclause 10.9<p>.
206      *
207      * @param d the array of double
208      * @param start the start position in the array
209      * @param length the number of double to read from the array
210      * @throws org.xml.sax.SAXException any SAX exception, possibly
211      * wrapping another exception
212      */

213     public void doubles(double [] d, int start, int length) throws SAXException JavaDoc;
214
215     /**
216      * Receive notification of character data as an two array of UUID.
217      *
218      * <p>The application must not attempt to read from the array
219      * outside of the specified range.</p>
220      *
221      * <p>Such notifications will occur for a Fast Infoset SAX parser
222      * when processing data encoded using the "uuid" encoding
223      * algorithm, see subclause 10.10<p>.
224      *
225      * @param msblsb the array of long containing pairs of most signficant
226      * bits and least significant bits of the UUIDs
227      * @param start the start position in the array
228      * @param length the number of long to read from the array. This will
229      * be twice the number of UUIDs, which are pairs of two long values
230      * @throws org.xml.sax.SAXException any SAX exception, possibly
231      * wrapping another exception
232      */

233     public void uuids(long[] msblsb, int start, int length) throws SAXException JavaDoc;
234 }
235
Popular Tags