本文整理汇总了Java中com.sun.xml.internal.fastinfoset.EncodingConstants.ENCODING_ALGORITHM_APPLICATION_START属性的典型用法代码示例。如果您正苦于以下问题:Java EncodingConstants.ENCODING_ALGORITHM_APPLICATION_START属性的具体用法?Java EncodingConstants.ENCODING_ALGORITHM_APPLICATION_START怎么用?Java EncodingConstants.ENCODING_ALGORITHM_APPLICATION_START使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.sun.xml.internal.fastinfoset.EncodingConstants
的用法示例。
在下文中一共展示了EncodingConstants.ENCODING_ALGORITHM_APPLICATION_START属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: processCIIEncodingAlgorithm
protected final void processCIIEncodingAlgorithm(boolean addToTable) throws FastInfosetException, IOException {
_algorithmData = _octetBuffer;
_algorithmDataOffset = _octetBufferStart;
_algorithmDataLength = _octetBufferLength;
_isAlgorithmDataCloned = false;
if (_algorithmId >= EncodingConstants.ENCODING_ALGORITHM_APPLICATION_START) {
_algorithmURI = _v.encodingAlgorithm.get(_algorithmId - EncodingConstants.ENCODING_ALGORITHM_APPLICATION_START);
if (_algorithmURI == null) {
throw new EncodingAlgorithmException(CommonResourceBundle.getInstance().getString("message.URINotPresent", new Object[]{Integer.valueOf(_identifier)}));
}
} else if (_algorithmId > EncodingConstants.ENCODING_ALGORITHM_BUILTIN_END) {
// 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"));
}
if (addToTable) {
convertEncodingAlgorithmDataToCharacters();
_characterContentChunkTable.add(_characters, _characters.length);
}
}
示例2: convertEncodingAlgorithmDataToCharacters
protected String convertEncodingAlgorithmDataToCharacters(boolean isAttributeValue) throws FastInfosetException, IOException {
StringBuffer buffer = new StringBuffer();
if (_identifier < EncodingConstants.ENCODING_ALGORITHM_BUILTIN_END) {
Object array = BuiltInEncodingAlgorithmFactory.getAlgorithm(_identifier).
decodeFromBytes(_octetBuffer, _octetBufferStart, _octetBufferLength);
BuiltInEncodingAlgorithmFactory.getAlgorithm(_identifier).convertToCharacters(array, buffer);
} else if (_identifier == EncodingAlgorithmIndexes.CDATA) {
if (!isAttributeValue) {
// Set back buffer position to start of encoded string
_octetBufferOffset -= _octetBufferLength;
return decodeUtf8StringAsString();
}
throw new EncodingAlgorithmException(CommonResourceBundle.getInstance().getString("message.CDATAAlgorithmNotSupported"));
} else if (_identifier >= EncodingConstants.ENCODING_ALGORITHM_APPLICATION_START) {
final String URI = _v.encodingAlgorithm.get(_identifier - EncodingConstants.ENCODING_ALGORITHM_APPLICATION_START);
final EncodingAlgorithm ea = (EncodingAlgorithm)_registeredEncodingAlgorithms.get(URI);
if (ea != null) {
final Object data = ea.decodeFromBytes(_octetBuffer, _octetBufferStart, _octetBufferLength);
ea.convertToCharacters(data, buffer);
} else {
throw new EncodingAlgorithmException(
CommonResourceBundle.getInstance().getString("message.algorithmDataCannotBeReported"));
}
}
return buffer.toString();
}
示例3: convertEncodingAlgorithmDataToCharacters
protected final void convertEncodingAlgorithmDataToCharacters() throws FastInfosetException, IOException {
StringBuffer buffer = new StringBuffer();
if (_algorithmId == EncodingAlgorithmIndexes.BASE64) {
convertBase64AlorithmDataToCharacters(buffer);
} else if (_algorithmId < EncodingConstants.ENCODING_ALGORITHM_BUILTIN_END) {
Object array = BuiltInEncodingAlgorithmFactory.getAlgorithm(_algorithmId).
decodeFromBytes(_algorithmData, _algorithmDataOffset, _algorithmDataLength);
BuiltInEncodingAlgorithmFactory.getAlgorithm(_algorithmId).convertToCharacters(array, buffer);
} else if (_algorithmId == EncodingAlgorithmIndexes.CDATA) {
_octetBufferOffset -= _octetBufferLength;
decodeUtf8StringIntoCharBuffer();
_characters = _charBuffer;
_charactersOffset = 0;
return;
} else if (_algorithmId >= EncodingConstants.ENCODING_ALGORITHM_APPLICATION_START) {
final EncodingAlgorithm ea = (EncodingAlgorithm)_registeredEncodingAlgorithms.get(_algorithmURI);
if (ea != null) {
final Object data = ea.decodeFromBytes(_octetBuffer, _octetBufferStart, _octetBufferLength);
ea.convertToCharacters(data, buffer);
} else {
throw new EncodingAlgorithmException(
CommonResourceBundle.getInstance().getString("message.algorithmDataCannotBeReported"));
}
}
_characters = new char[buffer.length()];
buffer.getChars(0, buffer.length(), _characters, 0);
_charactersOffset = 0;
_charBufferLength = _characters.length;
}