001: /*
002: * Fast Infoset ver. 0.1 software ("Software")
003: *
004: * Copyright, 2004-2005 Sun Microsystems, Inc. All Rights Reserved.
005: *
006: * Software is licensed under the Apache License, Version 2.0 (the "License");
007: * you may not use this file except in compliance with the License. You may
008: * obtain a copy of the License at:
009: *
010: * http://www.apache.org/licenses/LICENSE-2.0
011: *
012: * Unless required by applicable law or agreed to in writing, software
013: * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
014: * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
015: * License for the specific language governing permissions and limitations.
016: *
017: * Sun supports and benefits from the global community of open source
018: * developers, and thanks the community for its important contributions and
019: * open standards-based technology, which Sun has adopted into many of its
020: * products.
021: *
022: * Please note that portions of Software may be provided with notices and
023: * open source licenses from such communities and third parties that govern the
024: * use of those portions, and any licenses granted hereunder do not alter any
025: * rights and obligations you may have under such open source licenses,
026: * however, the disclaimer of warranty and limitation of liability provisions
027: * in this License will apply to all Software in this distribution.
028: *
029: * You acknowledge that the Software is not designed, licensed or intended
030: * for use in the design, construction, operation or maintenance of any nuclear
031: * facility.
032: *
033: * Apache License
034: * Version 2.0, January 2004
035: * http://www.apache.org/licenses/
036: *
037: */
038:
039: package org.jvnet.fastinfoset.sax;
040:
041: import org.xml.sax.SAXException;
042:
043: /**
044: * SAX2 extention handler to receive notification of encoding algorithm data.
045: *
046: * <p>This is an optional extension handler for SAX2. XML readers are not
047: * required to recognize this handler, and it is not part of core-only
048: * SAX2 distributions.</p>
049: *
050: * <p>This interface may be used with with a Fast Infoset
051: * SAX parser to receive notification of encoding algorithm data specified
052: * in ITU-T Rec. X.891 | ISO/IEC 24824-1 (Fast Infoset) clause 10 and for
053: * application defined encoding algorithms specified as part of the
054: * initial vocabulary of a fast infoset document.<p>
055: *
056: * <p>To set the EncodingAlgorithmContentHandler for an XML reader, use the
057: * {@link org.xml.sax.XMLReader#setProperty setProperty} method
058: * with the property name
059: * <code>URI TO BE DEFINED</code>
060: * and an object implementing this interface (or null) as the value.
061: * If the reader does not report primitive data types, it will throw a
062: * {@link org.xml.sax.SAXNotRecognizedException SAXNotRecognizedException}</p>
063: *
064: * <p>To set the EncodingAlgorithmContentHandler for an Fast Infoset reader, use
065: * {@link org.jvnet.fastinfoset.sax.FastInfosetReader#setEncodingAlgorithmContentHandler
066: * setEncodingAlgorithmContentHandler} method.<p>
067: *
068: * @see org.jvnet.fastinfoset.sax.PrimitiveTypeContentHandler
069: * @see org.jvnet.fastinfoset.sax.FastInfosetReader
070: * @see org.xml.sax.XMLReader
071: */
072: public interface EncodingAlgorithmContentHandler {
073: /**
074: * Receive notification of encoding algorithm data as an array
075: * of byte.
076: *
077: * <p>The application must not attempt to read from the array
078: * outside of the specified range.</p>
079: *
080: * <p>Such notifications will occur for a Fast Infoset SAX parser
081: * when processing encoding algorithm data.<p>
082: *
083: * <p>The Parser will call the method of this interface to report each
084: * encoding algorithm data. Parsers MUST return all contiguous
085: * characters in a single chunk</p>
086: *
087: * <p>Parsers may return all contiguous bytes in a single chunk, or
088: * they may split it into several chunks providing that the length of
089: * each chunk is of the required length to successfully apply the
090: * encoding algorithm to the chunk.</p>
091: *
092: * @param URI the URI of the encoding algorithm
093: * @param algorithm the encoding algorithm index
094: * @param b the array of byte
095: * @param start the start position in the array
096: * @param length the number of byte to read from the array
097: * @throws org.xml.sax.SAXException any SAX exception, possibly
098: * wrapping another exception
099: * @see org.jvnet.fastinfoset.EncodingAlgorithmIndexes
100: */
101: public void octets(String URI, int algorithm, byte[] b, int start,
102: int length) throws SAXException;
103:
104: /**
105: * Receive notification of encoding algorithm data as an object.
106: *
107: * <p>Such notifications will occur for a Fast Infoset SAX parser
108: * when processing encoding algorithm data that is converted from an
109: * array of byte to an object more suitable for processing.<p>
110: *
111: * @param URI the URI of the encoding algorithm
112: * @param algorithm the encoding algorithm index
113: * @param o the encoding algorithm object
114: * @throws org.xml.sax.SAXException any SAX exception, possibly
115: * wrapping another exception
116: * @see org.jvnet.fastinfoset.EncodingAlgorithmIndexes
117: */
118: public void object(String URI, int algorithm, Object o)
119: throws SAXException;
120: }
|