本文整理汇总了Java中com.sun.xml.internal.org.jvnet.fastinfoset.EncodingAlgorithm.convertToCharacters方法的典型用法代码示例。如果您正苦于以下问题:Java EncodingAlgorithm.convertToCharacters方法的具体用法?Java EncodingAlgorithm.convertToCharacters怎么用?Java EncodingAlgorithm.convertToCharacters使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sun.xml.internal.org.jvnet.fastinfoset.EncodingAlgorithm
的用法示例。
在下文中一共展示了EncodingAlgorithm.convertToCharacters方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: convertEncodingAlgorithmDataToCharacters
import com.sun.xml.internal.org.jvnet.fastinfoset.EncodingAlgorithm; //导入方法依赖的package包/类
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();
}
示例2: convertEncodingAlgorithmDataToCharacters
import com.sun.xml.internal.org.jvnet.fastinfoset.EncodingAlgorithm; //导入方法依赖的package包/类
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;
}