当前位置: 首页>>代码示例>>Java>>正文


Java EncodingConstants类代码示例

本文整理汇总了Java中com.sun.xml.internal.fastinfoset.EncodingConstants的典型用法代码示例。如果您正苦于以下问题:Java EncodingConstants类的具体用法?Java EncodingConstants怎么用?Java EncodingConstants使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


EncodingConstants类属于com.sun.xml.internal.fastinfoset包,在下文中一共展示了EncodingConstants类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: processUnexpandedEntityReference

import com.sun.xml.internal.fastinfoset.EncodingConstants; //导入依赖的package包/类
protected final void processUnexpandedEntityReference(final int b) throws FastInfosetException, IOException {
    _eventType = ENTITY_REFERENCE;

    /*
     * TODO
     * How does StAX report such events?
     */
    String entity_reference_name = decodeIdentifyingNonEmptyStringOnFirstBit(_v.otherNCName);

    String system_identifier = ((b & EncodingConstants.UNEXPANDED_ENTITY_SYSTEM_IDENTIFIER_FLAG) > 0)
    ? decodeIdentifyingNonEmptyStringOnFirstBit(_v.otherURI) : "";
    String public_identifier = ((b & EncodingConstants.UNEXPANDED_ENTITY_PUBLIC_IDENTIFIER_FLAG) > 0)
    ? decodeIdentifyingNonEmptyStringOnFirstBit(_v.otherURI) : "";

    if (logger.isLoggable(Level.FINEST)) {
        logger.log(Level.FINEST, "processUnexpandedEntityReference: entity_reference_name={0} system_identifier={1}public_identifier={2}",
                new Object[]{entity_reference_name, system_identifier, public_identifier});
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:20,代码来源:StAXDocumentParser.java

示例2: processCIIEncodingAlgorithm

import com.sun.xml.internal.fastinfoset.EncodingConstants; //导入依赖的package包/类
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);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:24,代码来源:StAXDocumentParser.java

示例3: writeNamespace

import com.sun.xml.internal.fastinfoset.EncodingConstants; //导入依赖的package包/类
public void writeNamespace(String prefix, String namespaceURI)
    throws XMLStreamException
{
    if (prefix == null || prefix.length() == 0 || prefix.equals(EncodingConstants.XMLNS_NAMESPACE_PREFIX)) {
        writeDefaultNamespace(namespaceURI);
    }
    else {
        if (!_inStartElement) {
            throw new IllegalStateException(CommonResourceBundle.getInstance().getString("message.attributeWritingNotAllowed"));
        }

        if (_namespacesArrayIndex == _namespacesArray.length) {
            final String[] namespacesArray = new String[_namespacesArrayIndex * 2];
            System.arraycopy(_namespacesArray, 0, namespacesArray, 0, _namespacesArrayIndex);
            _namespacesArray = namespacesArray;
        }

        _namespacesArray[_namespacesArrayIndex++] = prefix;
        _namespacesArray[_namespacesArrayIndex++] = namespaceURI;
        setPrefix(prefix, namespaceURI);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:23,代码来源:StAXDocumentSerializer.java

示例4: convertVocabulary

import com.sun.xml.internal.fastinfoset.EncodingConstants; //导入依赖的package包/类
private void convertVocabulary(com.sun.xml.internal.org.jvnet.fastinfoset.Vocabulary v) {
    final StringIntMap prefixMap = new FixedEntryStringIntMap(
            EncodingConstants.XML_NAMESPACE_PREFIX, 8);
    final StringIntMap namespaceNameMap = new FixedEntryStringIntMap(
            EncodingConstants.XML_NAMESPACE_NAME, 8);
    final StringIntMap localNameMap = new StringIntMap();

    addToTable(v.restrictedAlphabets.iterator(), restrictedAlphabet);
    addToTable(v.encodingAlgorithms.iterator(), encodingAlgorithm);
    addToTable(v.prefixes.iterator(), prefix, prefixMap);
    addToTable(v.namespaceNames.iterator(), namespaceName, namespaceNameMap);
    addToTable(v.localNames.iterator(), localName, localNameMap);
    addToTable(v.otherNCNames.iterator(), otherNCName);
    addToTable(v.otherURIs.iterator(), otherURI);
    addToTable(v.attributeValues.iterator(), attributeValue);
    addToTable(v.otherStrings.iterator(), otherString);
    addToTable(v.characterContentChunks.iterator(), characterContentChunk);
    addToTable(v.elements.iterator(), elementName, false,
            prefixMap, namespaceNameMap, localNameMap);
    addToTable(v.attributes.iterator(), attributeName, true,
            prefixMap, namespaceNameMap, localNameMap);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:23,代码来源:ParserVocabulary.java

示例5: convertEncodingAlgorithmDataToCharacters

import com.sun.xml.internal.fastinfoset.EncodingConstants; //导入依赖的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();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:27,代码来源:DOMDocumentParser.java

示例6: startPrefixMapping

import com.sun.xml.internal.fastinfoset.EncodingConstants; //导入依赖的package包/类
public void startPrefixMapping(String prefix, String uri) throws SAXException {
    try {
        if (_elementHasNamespaces == false) {
            encodeTermination();

            // Mark the current buffer position to flag attributes if necessary
            mark();
            _elementHasNamespaces = true;

            // Write out Element byte with namespaces
            write(EncodingConstants.ELEMENT | EncodingConstants.ELEMENT_NAMESPACES_FLAG);
        }

        encodeNamespaceAttribute(prefix, uri);
    } catch (IOException e) {
        throw new SAXException("startElement", e);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:19,代码来源:SAXDocumentSerializer.java

示例7: beginStartTag

import com.sun.xml.internal.fastinfoset.EncodingConstants; //导入依赖的package包/类
@Override
public void beginStartTag(Name name) throws IOException {
    fiout.writeLowLevelTerminationAndMark();

    if (nsContext.getCurrent().count() == 0) {
        final int qNameIndex = tables.elementIndexes[name.qNameIndex] - tables.indexOffset;
        final int prefixIndex = nsUriIndex2prefixIndex[name.nsUriIndex];

        if (qNameIndex >= 0 &&
                tables.elementIndexPrefixes[name.qNameIndex] == prefixIndex) {
            fiout.writeLowLevelStartElementIndexed(EncodingConstants.ELEMENT, qNameIndex);
        } else {
            tables.elementIndexes[name.qNameIndex] = fiout.getNextElementIndex() + tables.indexOffset;
            tables.elementIndexPrefixes[name.qNameIndex] = prefixIndex;
            writeLiteral(EncodingConstants.ELEMENT | EncodingConstants.ELEMENT_LITERAL_QNAME_FLAG,
                    name,
                    nsContext.getPrefix(prefixIndex),
                    nsContext.getNamespaceURI(prefixIndex));
        }
    } else {
        beginStartTagWithNamespaces(name);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:24,代码来源:FastInfosetStreamWriterOutput.java


注:本文中的com.sun.xml.internal.fastinfoset.EncodingConstants类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。