org.xml.sax.ext.DeclHandler#com.sun.xml.internal.fastinfoset.CommonResourceBundle源码实例Demo

下面列出了org.xml.sax.ext.DeclHandler#com.sun.xml.internal.fastinfoset.CommonResourceBundle 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: TencentKona-8   文件: ContiguousCharArrayArray.java
protected final void resize() {
    if (_size == _maximumCapacity) {
        throw new ValueArrayResourceException(CommonResourceBundle.getInstance().getString("message.arrayMaxCapacity"));
    }

    int newSize = _size * 3 / 2 + 1;
    if (newSize > _maximumCapacity) {
        newSize = _maximumCapacity;
    }

    final int[] offset = new int[newSize];
    System.arraycopy(_offset, 0, offset, 0, _size);
    _offset = offset;

    final int[] length = new int[newSize];
    System.arraycopy(_length, 0, length, 0, _size);
    _length = length;
}
 
源代码2 项目: TencentKona-8   文件: StAXDocumentParser.java
/** if the current tag has already read, such as in the case EventReader's
 * peek() has been called, the current cursor should not move before the loop
 */
public final int nextTag(boolean currentTagRead) throws XMLStreamException {
    int eventType = getEventType();
    if (!currentTagRead) {
        eventType = next();
    }
    while((eventType == CHARACTERS && isWhiteSpace()) // skip whitespace
    || (eventType == CDATA && isWhiteSpace())
    || eventType == SPACE
            || eventType == PROCESSING_INSTRUCTION
            || eventType == COMMENT) {
        eventType = next();
    }
    if (eventType != START_ELEMENT && eventType != END_ELEMENT) {
        throw new XMLStreamException(CommonResourceBundle.getInstance().getString("message.expectedStartOrEnd"), getLocation());
    }
    return eventType;
}
 
源代码3 项目: TencentKona-8   文件: StAXDocumentParser.java
protected final void processProcessingII() throws FastInfosetException, IOException {
    _eventType = PROCESSING_INSTRUCTION;

    _piTarget = decodeIdentifyingNonEmptyStringOnFirstBit(_v.otherNCName);

    switch(decodeNonIdentifyingStringOnFirstBit()) {
        case NISTRING_STRING:
            _piData = new String(_charBuffer, 0, _charBufferLength);
            if (_addToTable) {
                _v.otherString.add(new CharArrayString(_piData));
            }
            break;
        case NISTRING_ENCODING_ALGORITHM:
            throw new FastInfosetException(CommonResourceBundle.getInstance().getString("message.processingIIWithEncodingAlgorithm"));
        case NISTRING_INDEX:
            _piData = _v.otherString.get(_integer).toString();
            break;
        case NISTRING_EMPTY_STRING:
            _piData = "";
            break;
    }
}
 
源代码4 项目: TencentKona-8   文件: StAXDocumentSerializer.java
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);
    }
}
 
源代码5 项目: TencentKona-8   文件: PrefixArray.java
protected final void resize() {
    if (_size == _maximumCapacity) {
        throw new ValueArrayResourceException(CommonResourceBundle.getInstance().getString("message.arrayMaxCapacity"));
    }

    int newSize = _size * 3 / 2 + 1;
    if (newSize > _maximumCapacity) {
        newSize = _maximumCapacity;
    }

    final String[] newArray = new String[newSize];
    System.arraycopy(_array, 0, newArray, 0, _size);
    _array = newArray;

    newSize += 2;
    final NamespaceEntry[] newInScopeNamespaces = new NamespaceEntry[newSize];
    System.arraycopy(_inScopeNamespaces, 0, newInScopeNamespaces, 0, _inScopeNamespaces.length);
    _inScopeNamespaces = newInScopeNamespaces;

    final int[] newCurrentInScope = new int[newSize];
    System.arraycopy(_currentInScope, 0, newCurrentInScope, 0, _currentInScope.length);
    _currentInScope = newCurrentInScope;
}
 
源代码6 项目: TencentKona-8   文件: DOMDocumentParser.java
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();
}
 
源代码7 项目: TencentKona-8   文件: UUIDEncodingAlgorithm.java
final void fromUUIDString(String name) {
    String[] components = name.split("-");
    if (components.length != 5)
        throw new IllegalArgumentException(CommonResourceBundle.getInstance().
                getString("message.invalidUUID", new Object[]{name}));

    for (int i=0; i<5; i++)
        components[i] = "0x"+components[i];

    _msb = Long.parseLong(components[0], 16);
    _msb <<= 16;
    _msb |= Long.parseLong(components[1], 16);
    _msb <<= 16;
    _msb |= Long.parseLong(components[2], 16);

    _lsb = Long.parseLong(components[3], 16);
    _lsb <<= 48;
    _lsb |= Long.parseLong(components[4], 16);
}
 
源代码8 项目: TencentKona-8   文件: StAXInputFactory.java
/** Get the value of a feature/property from the underlying implementation
 * @param name The name of the property (may not be null)
 * @return The value of the property
 * @throws IllegalArgumentException if the property is not supported
 */
public Object getProperty(String name) throws IllegalArgumentException {
    if(name == null){
        throw new IllegalArgumentException(CommonResourceBundle.getInstance().getString("message.nullPropertyName"));
    }
    if(_manager.containsProperty(name))
        return _manager.getProperty(name);
    throw new IllegalArgumentException(CommonResourceBundle.getInstance().getString("message.propertyNotSupported", new Object[]{name}));
}
 
源代码9 项目: TencentKona-8   文件: StAXManager.java
public void setProperty(String name, Object value){
    checkProperty(name);
    if (name.equals(XMLInputFactory.IS_VALIDATING) &&
            Boolean.TRUE.equals(value)){
        throw new IllegalArgumentException(CommonResourceBundle.getInstance().getString("message.validationNotSupported") +
                CommonResourceBundle.getInstance().getString("support_validation"));
    } else if (name.equals(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES) &&
            Boolean.TRUE.equals(value)) {
        throw new IllegalArgumentException(CommonResourceBundle.getInstance().getString("message.externalEntities") +
                CommonResourceBundle.getInstance().getString("resolve_external_entities_"));
    }
    features.put(name,value);

}
 
源代码10 项目: TencentKona-8   文件: SAXDocumentParser.java
public boolean getFeature(String name)
throws SAXNotRecognizedException, SAXNotSupportedException {
    if (name.equals(Features.NAMESPACES_FEATURE)) {
        return true;
    } else if (name.equals(Features.NAMESPACE_PREFIXES_FEATURE)) {
        return _namespacePrefixesFeature;
    } else if (name.equals(Features.STRING_INTERNING_FEATURE) ||
            name.equals(FastInfosetReader.STRING_INTERNING_PROPERTY)) {
        return getStringInterning();
    } else {
        throw new SAXNotRecognizedException(
                CommonResourceBundle.getInstance().getString("message.featureNotSupported") + name);
    }
}
 
源代码11 项目: TencentKona-8   文件: SAXEventSerializer.java
public int compareTo(Object o) {
    try {
        return qName.compareTo(((AttributeValueHolder) o).qName);
    } catch (Exception e) {
        throw new RuntimeException(CommonResourceBundle.getInstance().getString("message.AttributeValueHolderExpected"));
    }
}
 
源代码12 项目: TencentKona-8   文件: StAXFilteredEvent.java
public XMLEvent nextTag() throws XMLStreamException {
    while(hasNext()) {
        XMLEvent e = nextEvent();
        if (e.isStartElement() || e.isEndElement())
            return e;
    }
    throw new XMLStreamException(CommonResourceBundle.getInstance().getString("message.startOrEndNotFound"));
}
 
源代码13 项目: TencentKona-8   文件: StAXEventWriter.java
/**
 *
 * @param eventReader
 * @throws XMLStreamException
 */
public void add(XMLEventReader eventReader) throws XMLStreamException {
    if(eventReader == null) throw new XMLStreamException(CommonResourceBundle.getInstance().getString("message.nullEventReader"));
    while(eventReader.hasNext()){
        add(eventReader.nextEvent());
    }
}
 
源代码14 项目: TencentKona-8   文件: StringArray.java
protected final void resize() {
    if (_size == _maximumCapacity) {
        throw new ValueArrayResourceException(CommonResourceBundle.getInstance().getString("message.arrayMaxCapacity"));
    }

    int newSize = _size * 3 / 2 + 1;
    if (newSize > _maximumCapacity) {
        newSize = _maximumCapacity;
    }

    final String[] newArray = new String[newSize];
    System.arraycopy(_array, 0, newArray, 0, _size);
    _array = newArray;
}
 
源代码15 项目: TencentKona-8   文件: FixedEntryStringIntMap.java
public final void setReadOnlyMap(KeyIntMap readOnlyMap, boolean clear) {
    if (!(readOnlyMap instanceof FixedEntryStringIntMap)) {
        throw new IllegalArgumentException(CommonResourceBundle.getInstance().
                getString("message.illegalClass", new Object[]{readOnlyMap}));
    }

    setReadOnlyMap((FixedEntryStringIntMap)readOnlyMap, clear);
}
 
源代码16 项目: TencentKona-8   文件: EventBase.java
/**
* Returns this event as a start element event, may result in
* a class cast exception if this event is not a start element.
*/
 public StartElement asStartElement() {
     if (isStartElement()) {
         return (StartElement)this;
     } else
         throw new ClassCastException(CommonResourceBundle.getInstance().getString("message.startElementCase", new Object[]{getEventTypeString()}));
 }
 
源代码17 项目: TencentKona-8   文件: StAXDocumentParser.java
/** Test if the current event is of the given type and if the namespace and name match the current namespace and name of the current event.
 * If the namespaceURI is null it is not checked for equality, if the localName is null it is not checked for equality.
 * @param type the event type
 * @param namespaceURI the uri of the event, may be null
 * @param localName the localName of the event, may be null
 * @throws XMLStreamException if the required values are not matched.
 */
public final void require(int type, String namespaceURI, String localName)
throws XMLStreamException {
    if( type != _eventType)
        throw new XMLStreamException(CommonResourceBundle.getInstance().getString("message.eventTypeNotMatch", new Object[]{getEventTypeString(type)}));
    if( namespaceURI != null && !namespaceURI.equals(getNamespaceURI()) )
        throw new XMLStreamException(CommonResourceBundle.getInstance().getString("message.namespaceURINotMatch", new Object[]{namespaceURI}));
    if(localName != null && !localName.equals(getLocalName()))
        throw new XMLStreamException(CommonResourceBundle.getInstance().getString("message.localNameNotMatch", new Object[]{localName}));
}
 
源代码18 项目: TencentKona-8   文件: SAXDocumentSerializer.java
public final void processingInstruction(String target, String data) throws SAXException {
    try {
        if (getIgnoreProcesingInstructions()) return;

        if (target.length() == 0) {
            throw new SAXException(CommonResourceBundle.getInstance().
                    getString("message.processingInstructionTargetIsEmpty"));
        }
        encodeTermination();

        encodeProcessingInstruction(target, data);
    } catch (IOException e) {
        throw new SAXException("processingInstruction", e);
    }
}
 
源代码19 项目: TencentKona-8   文件: StAXDocumentParser.java
public final String getNamespaceURI(String prefix) {
    String namespace = getNamespaceDecl(prefix);
    if (namespace == null) {
        if (prefix == null) {
            throw new IllegalArgumentException(CommonResourceBundle.getInstance().getString("message.nullPrefix"));
        }
        return null;  // unbound
    }
    return namespace;
}
 
源代码20 项目: TencentKona-8   文件: StringIntMap.java
public void setReadOnlyMap(KeyIntMap readOnlyMap, boolean clear) {
    if (!(readOnlyMap instanceof StringIntMap)) {
        throw new IllegalArgumentException(CommonResourceBundle.getInstance().
                getString("message.illegalClass", new Object[]{readOnlyMap}));
    }

    setReadOnlyMap((StringIntMap)readOnlyMap, clear);
}
 
源代码21 项目: TencentKona-8   文件: StAXDocumentParser.java
public final int getAttributeCount() {
    if (_eventType != START_ELEMENT) {
        throw new IllegalStateException(CommonResourceBundle.getInstance().getString("message.invalidCallingGetAttributeValue"));
    }

    return _attributes.getLength();
}
 
源代码22 项目: TencentKona-8   文件: StAXDocumentParser.java
public final String getAttributeNamespace(int index) {
    if (_eventType != START_ELEMENT) {
        throw new IllegalStateException(CommonResourceBundle.getInstance().getString("message.invalidCallingGetAttributeValue"));
    }

    return _attributes.getURI(index);
}
 
源代码23 项目: TencentKona-8   文件: StAXDocumentParser.java
public final int getNamespaceCount() {
    if (_eventType == START_ELEMENT || _eventType == END_ELEMENT) {
        return (_currentNamespaceAIIsEnd > 0) ? (_currentNamespaceAIIsEnd - _currentNamespaceAIIsStart) : 0;
    } else {
        throw new IllegalStateException(CommonResourceBundle.getInstance().getString("message.invalidCallingGetNamespaceCount"));
    }
}
 
源代码24 项目: TencentKona-8   文件: StAXDocumentParser.java
public final String getNamespacePrefix(int index) {
    if (_eventType == START_ELEMENT || _eventType == END_ELEMENT) {
        return _namespaceAIIsPrefix[_currentNamespaceAIIsStart + index];
    } else {
        throw new IllegalStateException(CommonResourceBundle.getInstance().getString("message.invalidCallingGetNamespacePrefix"));
    }
}
 
源代码25 项目: TencentKona-8   文件: StAXDocumentParser.java
public final String getNamespaceURI(int index) {
    if (_eventType == START_ELEMENT || _eventType == END_ELEMENT) {
        return _namespaceAIIsNamespaceName[_currentNamespaceAIIsStart + index];
    } else {
        throw new IllegalStateException(CommonResourceBundle.getInstance().getString("message.invalidCallingGetNamespacePrefix"));
    }
}
 
源代码26 项目: TencentKona-8   文件: StAXDocumentParser.java
protected final void checkTextState() {
    if (_algorithmData == null) {
        throw new IllegalStateException(CommonResourceBundle.getInstance().getString("message.InvalidStateForText"));
    }

    try {
        convertEncodingAlgorithmDataToCharacters();
    } catch (Exception e) {
        throw new IllegalStateException(CommonResourceBundle.getInstance().getString("message.InvalidStateForText"));
    }
}
 
源代码27 项目: TencentKona-8   文件: StAXDocumentParser.java
public final QName getName() {
    if (_eventType == START_ELEMENT || _eventType == END_ELEMENT) {
        return _qualifiedName.getQName();
    } else {
        throw new IllegalStateException(CommonResourceBundle.getInstance().getString("message.invalidCallingGetName"));
    }
}
 
源代码28 项目: TencentKona-8   文件: LocalNameQualifiedNamesMap.java
public final void setReadOnlyMap(KeyIntMap readOnlyMap, boolean clear) {
    if (!(readOnlyMap instanceof LocalNameQualifiedNamesMap)) {
        throw new IllegalArgumentException(CommonResourceBundle.getInstance().
                getString("message.illegalClass", new Object[]{readOnlyMap}));
    }

    setReadOnlyMap((LocalNameQualifiedNamesMap)readOnlyMap, clear);
}
 
源代码29 项目: TencentKona-8   文件: StAXDocumentParser.java
public final String getNamespaceURI() {
    if (_eventType == START_ELEMENT || _eventType == END_ELEMENT) {
        return _qualifiedName.namespaceName;
    } else {
        throw new IllegalStateException(CommonResourceBundle.getInstance().getString("message.invalidCallingGetNamespaceURI"));
    }
}
 
源代码30 项目: TencentKona-8   文件: ContiguousCharArrayArray.java
protected final void resizeArray(int requestedSize) {
    if (_arrayIndex == _maximumCharacterSize) {
        throw new ValueArrayResourceException(CommonResourceBundle.getInstance().getString("message.maxNumberOfCharacters"));
    }

    int newSize = requestedSize * 3 / 2 + 1;
    if (newSize > _maximumCharacterSize) {
        newSize = _maximumCharacterSize;
    }

    final char[] array = new char[newSize];
    System.arraycopy(_array, 0, array, 0, _arrayIndex);
    _array = array;
}