_toIndex = toIndex;
}
private final StringBuffer convertEncodingAlgorithmDataToString(
int identifier, String URI, Object data) throws FastInfosetException, IOException {
EncodingAlgorithm ea = null;
if (identifier < EncodingConstants.ENCODING_ALGORITHM_BUILTIN_END) {
ea = BuiltInEncodingAlgorithmFactory.getAlgorithm(identifier);
} else if (identifier == EncodingAlgorithmIndexes.CDATA) {
throw new EncodingAlgorithmException(
CommonResourceBundle.getInstance().getString("message.CDATAAlgorithmNotSupported"));
} else if (identifier >= EncodingConstants.ENCODING_ALGORITHM_APPLICATION_START) {
if (URI == null) {
throw new EncodingAlgorithmException(
CommonResourceBundle.getInstance().getString("message.URINotPresent") + identifier);
}
ea = (EncodingAlgorithm)_registeredEncodingAlgorithms.get(URI);
if (ea == null) {
throw new EncodingAlgorithmException(
CommonResourceBundle.getInstance().getString("message.algorithmNotRegistered") + URI);
}
} else {
// Reserved built-in algorithms for future use
// TODO should use sax property to decide if event will be
// reported, allows for support through handler if required.
throw new EncodingAlgorithmException(
CommonResourceBundle.getInstance().getString("message.identifiers10to31Reserved"));
}
final StringBuffer sb = new StringBuffer();
ea.convertToCharacters(data, sb);
return sb;
}