Object array = processBuiltInEncodingAlgorithmAsObject();
try {
_algorithmHandler.object(null, _identifier, array);
} catch (SAXException e) {
throw new FastInfosetException(e);
}
} else {
StringBuffer buffer = new StringBuffer();
processBuiltInEncodingAlgorithmAsCharacters(buffer);
try {
_contentHandler.characters(buffer.toString().toCharArray(), 0, buffer.length());
} catch (SAXException e) {
throw new FastInfosetException(e);
}
}
if (addToTable) {
StringBuffer buffer = new StringBuffer();
processBuiltInEncodingAlgorithmAsCharacters(buffer);
_characterContentChunkTable.add(buffer.toString().toCharArray(), buffer.length());
}
} else if (_identifier == EncodingAlgorithmIndexes.CDATA) {
// Set back buffer position to start of encoded string
_octetBufferOffset -= _octetBufferLength;
decodeUtf8StringIntoCharBuffer();
try {
_lexicalHandler.startCDATA();
_contentHandler.characters(_charBuffer, 0, _charBufferLength);
_lexicalHandler.endCDATA();
} catch (SAXException e) {
throw new FastInfosetException(e);
}
if (addToTable) {
_characterContentChunkTable.add(_charBuffer, _charBufferLength);
}
} else if (_identifier >= EncodingConstants.ENCODING_ALGORITHM_APPLICATION_START && _algorithmHandler != null) {
final String URI = _v.encodingAlgorithm.get(_identifier - EncodingConstants.ENCODING_ALGORITHM_APPLICATION_START);
if (URI == null) {
throw new EncodingAlgorithmException(CommonResourceBundle.getInstance().
getString("message.URINotPresent", new Object[]{Integer.valueOf(_identifier)}));
}
final EncodingAlgorithm ea = (EncodingAlgorithm)_registeredEncodingAlgorithms.get(URI);
if (ea != null) {
final Object data = ea.decodeFromBytes(_octetBuffer, _octetBufferStart, _octetBufferLength);
try {
_algorithmHandler.object(URI, _identifier, data);
} catch (SAXException e) {
throw new FastInfosetException(e);
}
} else {
try {
_algorithmHandler.octets(URI, _identifier, _octetBuffer, _octetBufferStart, _octetBufferLength);
} catch (SAXException e) {
throw new FastInfosetException(e);
}
}
if (addToTable) {
throw new EncodingAlgorithmException(CommonResourceBundle.getInstance().getString("message.addToTableNotSupported"));
}