com.sun.xml.internal.fastinfoset.util.QualifiedNameArray Java Examples

The following examples show how to use com.sun.xml.internal.fastinfoset.util.QualifiedNameArray. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PrintTable.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public static void printArray(String title, QualifiedNameArray a) {
    System.out.println(title);

    for (int i = 0; i < a.getSize(); i++) {
        QualifiedName name = a.getArray()[i];
        System.out.println("" + (name.index + 1) + ": " +
                "{" + name.namespaceName + "}" +
                name.prefix + ":" + name.localName);
    }
}
 
Example #2
Source File: PrintTable.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public static void printArray(String title, QualifiedNameArray a) {
    System.out.println(title);

    for (int i = 0; i < a.getSize(); i++) {
        QualifiedName name = a.getArray()[i];
        System.out.println("" + (name.index + 1) + ": " +
                "{" + name.namespaceName + "}" +
                name.prefix + ":" + name.localName);
    }
}
 
Example #3
Source File: ParserVocabulary.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/** Creates a new instance of ParserVocabulary */
public ParserVocabulary() {
    namespaceName = new StringArray(ValueArray.DEFAULT_CAPACITY, IDENTIFYING_STRING_TABLE_MAXIMUM_ITEMS, false);
    prefix = new PrefixArray(ValueArray.DEFAULT_CAPACITY, IDENTIFYING_STRING_TABLE_MAXIMUM_ITEMS);
    localName = new StringArray(ValueArray.DEFAULT_CAPACITY, IDENTIFYING_STRING_TABLE_MAXIMUM_ITEMS, false);
    otherNCName = new StringArray(ValueArray.DEFAULT_CAPACITY, IDENTIFYING_STRING_TABLE_MAXIMUM_ITEMS, false);
    otherURI = new StringArray(ValueArray.DEFAULT_CAPACITY, IDENTIFYING_STRING_TABLE_MAXIMUM_ITEMS, true);
    attributeValue = new StringArray(ValueArray.DEFAULT_CAPACITY, NON_IDENTIFYING_STRING_TABLE_MAXIMUM_ITEMS, true);
    otherString = new CharArrayArray(ValueArray.DEFAULT_CAPACITY, NON_IDENTIFYING_STRING_TABLE_MAXIMUM_ITEMS);

    characterContentChunk = new ContiguousCharArrayArray(ValueArray.DEFAULT_CAPACITY,
            NON_IDENTIFYING_STRING_TABLE_MAXIMUM_ITEMS,
            ContiguousCharArrayArray.INITIAL_CHARACTER_SIZE,
            NON_IDENTIFYING_STRING_TABLE_MAXIMUM_CHARACTERS);

    elementName = new QualifiedNameArray(ValueArray.DEFAULT_CAPACITY, IDENTIFYING_STRING_TABLE_MAXIMUM_ITEMS);
    attributeName = new QualifiedNameArray(ValueArray.DEFAULT_CAPACITY, IDENTIFYING_STRING_TABLE_MAXIMUM_ITEMS);

    tables[RESTRICTED_ALPHABET] = restrictedAlphabet;
    tables[ENCODING_ALGORITHM] = encodingAlgorithm;
    tables[PREFIX] = prefix;
    tables[NAMESPACE_NAME] = namespaceName;
    tables[LOCAL_NAME] = localName;
    tables[OTHER_NCNAME] = otherNCName;
    tables[OTHER_URI] = otherURI;
    tables[ATTRIBUTE_VALUE] = attributeValue;
    tables[OTHER_STRING] = otherString;
    tables[CHARACTER_CONTENT_CHUNK] = characterContentChunk;
    tables[ELEMENT_NAME] = elementName;
    tables[ATTRIBUTE_NAME] = attributeName;
}
 
Example #4
Source File: ParserVocabulary.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private void addToTable(Iterator i, QualifiedNameArray a,
        boolean isAttribute,
        StringIntMap prefixMap, StringIntMap namespaceNameMap,
        StringIntMap localNameMap) {
    while (i.hasNext()) {
        addToNameTable((QName)i.next(), a, isAttribute,
                prefixMap, namespaceNameMap, localNameMap);
    }
}
 
Example #5
Source File: ParserVocabulary.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private void addToNameTable(QName n, QualifiedNameArray a,
        boolean isAttribute,
        StringIntMap prefixMap, StringIntMap namespaceNameMap,
        StringIntMap localNameMap) {
    int namespaceURIIndex = -1;
    int prefixIndex = -1;
    if (n.getNamespaceURI().length() > 0) {
        namespaceURIIndex = namespaceNameMap.obtainIndex(n.getNamespaceURI());
        if (namespaceURIIndex == KeyIntMap.NOT_PRESENT) {
            namespaceURIIndex = namespaceName.getSize();
            namespaceName.add(n.getNamespaceURI());
        }

        if (n.getPrefix().length() > 0) {
            prefixIndex = prefixMap.obtainIndex(n.getPrefix());
            if (prefixIndex == KeyIntMap.NOT_PRESENT) {
                prefixIndex = prefix.getSize();
                prefix.add(n.getPrefix());
            }
        }
    }

    int localNameIndex = localNameMap.obtainIndex(n.getLocalPart());
    if (localNameIndex == KeyIntMap.NOT_PRESENT) {
        localNameIndex = localName.getSize();
        localName.add(n.getLocalPart());
    }

    QualifiedName name = new QualifiedName(n.getPrefix(), n.getNamespaceURI(), n.getLocalPart(),
            a.getSize(),
            prefixIndex, namespaceURIIndex, localNameIndex);
    if (isAttribute) {
        name.createAttributeValues(DuplicateAttributeVerifier.MAP_SIZE);
    }
    a.add(name);
}
 
Example #6
Source File: Decoder.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private void decodeTableItems(QualifiedNameArray array, boolean isAttribute) throws FastInfosetException, IOException {
    final int noOfItems = decodeNumberOfItemsOfSequence();

    for (int i = 0; i < noOfItems; i++) {
        final int b = read();

        String prefix = "";
        int prefixIndex = -1;
        if ((b & EncodingConstants.NAME_SURROGATE_PREFIX_FLAG) > 0) {
            prefixIndex = decodeIntegerIndexOnSecondBit();
            prefix = _v.prefix.get(prefixIndex);
        }

        String namespaceName = "";
        int namespaceNameIndex = -1;
        if ((b & EncodingConstants.NAME_SURROGATE_NAME_FLAG) > 0) {
            namespaceNameIndex = decodeIntegerIndexOnSecondBit();
            namespaceName = _v.namespaceName.get(namespaceNameIndex);
        }

        if (namespaceName == "" && prefix != "") {
            throw new FastInfosetException(CommonResourceBundle.getInstance().getString("message.missingNamespace"));
        }

        final int localNameIndex = decodeIntegerIndexOnSecondBit();
        final String localName = _v.localName.get(localNameIndex);

        QualifiedName qualifiedName = new QualifiedName(prefix, namespaceName, localName,
                prefixIndex, namespaceNameIndex, localNameIndex,
                _charBuffer);
        if (isAttribute) {
            qualifiedName.createAttributeValues(DuplicateAttributeVerifier.MAP_SIZE);
        }
        array.add(qualifiedName);
    }
}
 
Example #7
Source File: PrintTable.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public static void printArray(String title, QualifiedNameArray a) {
    System.out.println(title);

    for (int i = 0; i < a.getSize(); i++) {
        QualifiedName name = a.getArray()[i];
        System.out.println("" + (name.index + 1) + ": " +
                "{" + name.namespaceName + "}" +
                name.prefix + ":" + name.localName);
    }
}
 
Example #8
Source File: ParserVocabulary.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/** Creates a new instance of ParserVocabulary */
public ParserVocabulary() {
    namespaceName = new StringArray(ValueArray.DEFAULT_CAPACITY, IDENTIFYING_STRING_TABLE_MAXIMUM_ITEMS, false);
    prefix = new PrefixArray(ValueArray.DEFAULT_CAPACITY, IDENTIFYING_STRING_TABLE_MAXIMUM_ITEMS);
    localName = new StringArray(ValueArray.DEFAULT_CAPACITY, IDENTIFYING_STRING_TABLE_MAXIMUM_ITEMS, false);
    otherNCName = new StringArray(ValueArray.DEFAULT_CAPACITY, IDENTIFYING_STRING_TABLE_MAXIMUM_ITEMS, false);
    otherURI = new StringArray(ValueArray.DEFAULT_CAPACITY, IDENTIFYING_STRING_TABLE_MAXIMUM_ITEMS, true);
    attributeValue = new StringArray(ValueArray.DEFAULT_CAPACITY, NON_IDENTIFYING_STRING_TABLE_MAXIMUM_ITEMS, true);
    otherString = new CharArrayArray(ValueArray.DEFAULT_CAPACITY, NON_IDENTIFYING_STRING_TABLE_MAXIMUM_ITEMS);

    characterContentChunk = new ContiguousCharArrayArray(ValueArray.DEFAULT_CAPACITY,
            NON_IDENTIFYING_STRING_TABLE_MAXIMUM_ITEMS,
            ContiguousCharArrayArray.INITIAL_CHARACTER_SIZE,
            NON_IDENTIFYING_STRING_TABLE_MAXIMUM_CHARACTERS);

    elementName = new QualifiedNameArray(ValueArray.DEFAULT_CAPACITY, IDENTIFYING_STRING_TABLE_MAXIMUM_ITEMS);
    attributeName = new QualifiedNameArray(ValueArray.DEFAULT_CAPACITY, IDENTIFYING_STRING_TABLE_MAXIMUM_ITEMS);

    tables[RESTRICTED_ALPHABET] = restrictedAlphabet;
    tables[ENCODING_ALGORITHM] = encodingAlgorithm;
    tables[PREFIX] = prefix;
    tables[NAMESPACE_NAME] = namespaceName;
    tables[LOCAL_NAME] = localName;
    tables[OTHER_NCNAME] = otherNCName;
    tables[OTHER_URI] = otherURI;
    tables[ATTRIBUTE_VALUE] = attributeValue;
    tables[OTHER_STRING] = otherString;
    tables[CHARACTER_CONTENT_CHUNK] = characterContentChunk;
    tables[ELEMENT_NAME] = elementName;
    tables[ATTRIBUTE_NAME] = attributeName;
}
 
Example #9
Source File: ParserVocabulary.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private void addToTable(Iterator i, QualifiedNameArray a,
        boolean isAttribute,
        StringIntMap prefixMap, StringIntMap namespaceNameMap,
        StringIntMap localNameMap) {
    while (i.hasNext()) {
        addToNameTable((QName)i.next(), a, isAttribute,
                prefixMap, namespaceNameMap, localNameMap);
    }
}
 
Example #10
Source File: ParserVocabulary.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private void addToNameTable(QName n, QualifiedNameArray a,
        boolean isAttribute,
        StringIntMap prefixMap, StringIntMap namespaceNameMap,
        StringIntMap localNameMap) {
    int namespaceURIIndex = -1;
    int prefixIndex = -1;
    if (n.getNamespaceURI().length() > 0) {
        namespaceURIIndex = namespaceNameMap.obtainIndex(n.getNamespaceURI());
        if (namespaceURIIndex == KeyIntMap.NOT_PRESENT) {
            namespaceURIIndex = namespaceName.getSize();
            namespaceName.add(n.getNamespaceURI());
        }

        if (n.getPrefix().length() > 0) {
            prefixIndex = prefixMap.obtainIndex(n.getPrefix());
            if (prefixIndex == KeyIntMap.NOT_PRESENT) {
                prefixIndex = prefix.getSize();
                prefix.add(n.getPrefix());
            }
        }
    }

    int localNameIndex = localNameMap.obtainIndex(n.getLocalPart());
    if (localNameIndex == KeyIntMap.NOT_PRESENT) {
        localNameIndex = localName.getSize();
        localName.add(n.getLocalPart());
    }

    QualifiedName name = new QualifiedName(n.getPrefix(), n.getNamespaceURI(), n.getLocalPart(),
            a.getSize(),
            prefixIndex, namespaceURIIndex, localNameIndex);
    if (isAttribute) {
        name.createAttributeValues(DuplicateAttributeVerifier.MAP_SIZE);
    }
    a.add(name);
}
 
Example #11
Source File: Decoder.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private void decodeTableItems(QualifiedNameArray array, boolean isAttribute) throws FastInfosetException, IOException {
    final int noOfItems = decodeNumberOfItemsOfSequence();

    for (int i = 0; i < noOfItems; i++) {
        final int b = read();

        String prefix = "";
        int prefixIndex = -1;
        if ((b & EncodingConstants.NAME_SURROGATE_PREFIX_FLAG) > 0) {
            prefixIndex = decodeIntegerIndexOnSecondBit();
            prefix = _v.prefix.get(prefixIndex);
        }

        String namespaceName = "";
        int namespaceNameIndex = -1;
        if ((b & EncodingConstants.NAME_SURROGATE_NAME_FLAG) > 0) {
            namespaceNameIndex = decodeIntegerIndexOnSecondBit();
            namespaceName = _v.namespaceName.get(namespaceNameIndex);
        }

        if (namespaceName == "" && prefix != "") {
            throw new FastInfosetException(CommonResourceBundle.getInstance().getString("message.missingNamespace"));
        }

        final int localNameIndex = decodeIntegerIndexOnSecondBit();
        final String localName = _v.localName.get(localNameIndex);

        QualifiedName qualifiedName = new QualifiedName(prefix, namespaceName, localName,
                prefixIndex, namespaceNameIndex, localNameIndex,
                _charBuffer);
        if (isAttribute) {
            qualifiedName.createAttributeValues(DuplicateAttributeVerifier.MAP_SIZE);
        }
        array.add(qualifiedName);
    }
}
 
Example #12
Source File: ParserVocabulary.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/** Creates a new instance of ParserVocabulary */
public ParserVocabulary() {
    namespaceName = new StringArray(ValueArray.DEFAULT_CAPACITY, IDENTIFYING_STRING_TABLE_MAXIMUM_ITEMS, false);
    prefix = new PrefixArray(ValueArray.DEFAULT_CAPACITY, IDENTIFYING_STRING_TABLE_MAXIMUM_ITEMS);
    localName = new StringArray(ValueArray.DEFAULT_CAPACITY, IDENTIFYING_STRING_TABLE_MAXIMUM_ITEMS, false);
    otherNCName = new StringArray(ValueArray.DEFAULT_CAPACITY, IDENTIFYING_STRING_TABLE_MAXIMUM_ITEMS, false);
    otherURI = new StringArray(ValueArray.DEFAULT_CAPACITY, IDENTIFYING_STRING_TABLE_MAXIMUM_ITEMS, true);
    attributeValue = new StringArray(ValueArray.DEFAULT_CAPACITY, NON_IDENTIFYING_STRING_TABLE_MAXIMUM_ITEMS, true);
    otherString = new CharArrayArray(ValueArray.DEFAULT_CAPACITY, NON_IDENTIFYING_STRING_TABLE_MAXIMUM_ITEMS);

    characterContentChunk = new ContiguousCharArrayArray(ValueArray.DEFAULT_CAPACITY,
            NON_IDENTIFYING_STRING_TABLE_MAXIMUM_ITEMS,
            ContiguousCharArrayArray.INITIAL_CHARACTER_SIZE,
            NON_IDENTIFYING_STRING_TABLE_MAXIMUM_CHARACTERS);

    elementName = new QualifiedNameArray(ValueArray.DEFAULT_CAPACITY, IDENTIFYING_STRING_TABLE_MAXIMUM_ITEMS);
    attributeName = new QualifiedNameArray(ValueArray.DEFAULT_CAPACITY, IDENTIFYING_STRING_TABLE_MAXIMUM_ITEMS);

    tables[RESTRICTED_ALPHABET] = restrictedAlphabet;
    tables[ENCODING_ALGORITHM] = encodingAlgorithm;
    tables[PREFIX] = prefix;
    tables[NAMESPACE_NAME] = namespaceName;
    tables[LOCAL_NAME] = localName;
    tables[OTHER_NCNAME] = otherNCName;
    tables[OTHER_URI] = otherURI;
    tables[ATTRIBUTE_VALUE] = attributeValue;
    tables[OTHER_STRING] = otherString;
    tables[CHARACTER_CONTENT_CHUNK] = characterContentChunk;
    tables[ELEMENT_NAME] = elementName;
    tables[ATTRIBUTE_NAME] = attributeName;
}
 
Example #13
Source File: ParserVocabulary.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/** Creates a new instance of ParserVocabulary */
public ParserVocabulary() {
    namespaceName = new StringArray(ValueArray.DEFAULT_CAPACITY, IDENTIFYING_STRING_TABLE_MAXIMUM_ITEMS, false);
    prefix = new PrefixArray(ValueArray.DEFAULT_CAPACITY, IDENTIFYING_STRING_TABLE_MAXIMUM_ITEMS);
    localName = new StringArray(ValueArray.DEFAULT_CAPACITY, IDENTIFYING_STRING_TABLE_MAXIMUM_ITEMS, false);
    otherNCName = new StringArray(ValueArray.DEFAULT_CAPACITY, IDENTIFYING_STRING_TABLE_MAXIMUM_ITEMS, false);
    otherURI = new StringArray(ValueArray.DEFAULT_CAPACITY, IDENTIFYING_STRING_TABLE_MAXIMUM_ITEMS, true);
    attributeValue = new StringArray(ValueArray.DEFAULT_CAPACITY, NON_IDENTIFYING_STRING_TABLE_MAXIMUM_ITEMS, true);
    otherString = new CharArrayArray(ValueArray.DEFAULT_CAPACITY, NON_IDENTIFYING_STRING_TABLE_MAXIMUM_ITEMS);

    characterContentChunk = new ContiguousCharArrayArray(ValueArray.DEFAULT_CAPACITY,
            NON_IDENTIFYING_STRING_TABLE_MAXIMUM_ITEMS,
            ContiguousCharArrayArray.INITIAL_CHARACTER_SIZE,
            NON_IDENTIFYING_STRING_TABLE_MAXIMUM_CHARACTERS);

    elementName = new QualifiedNameArray(ValueArray.DEFAULT_CAPACITY, IDENTIFYING_STRING_TABLE_MAXIMUM_ITEMS);
    attributeName = new QualifiedNameArray(ValueArray.DEFAULT_CAPACITY, IDENTIFYING_STRING_TABLE_MAXIMUM_ITEMS);

    tables[RESTRICTED_ALPHABET] = restrictedAlphabet;
    tables[ENCODING_ALGORITHM] = encodingAlgorithm;
    tables[PREFIX] = prefix;
    tables[NAMESPACE_NAME] = namespaceName;
    tables[LOCAL_NAME] = localName;
    tables[OTHER_NCNAME] = otherNCName;
    tables[OTHER_URI] = otherURI;
    tables[ATTRIBUTE_VALUE] = attributeValue;
    tables[OTHER_STRING] = otherString;
    tables[CHARACTER_CONTENT_CHUNK] = characterContentChunk;
    tables[ELEMENT_NAME] = elementName;
    tables[ATTRIBUTE_NAME] = attributeName;
}
 
Example #14
Source File: ParserVocabulary.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
private void addToTable(Iterator i, QualifiedNameArray a,
        boolean isAttribute,
        StringIntMap prefixMap, StringIntMap namespaceNameMap,
        StringIntMap localNameMap) {
    while (i.hasNext()) {
        addToNameTable((QName)i.next(), a, isAttribute,
                prefixMap, namespaceNameMap, localNameMap);
    }
}
 
Example #15
Source File: ParserVocabulary.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
private void addToNameTable(QName n, QualifiedNameArray a,
        boolean isAttribute,
        StringIntMap prefixMap, StringIntMap namespaceNameMap,
        StringIntMap localNameMap) {
    int namespaceURIIndex = -1;
    int prefixIndex = -1;
    if (n.getNamespaceURI().length() > 0) {
        namespaceURIIndex = namespaceNameMap.obtainIndex(n.getNamespaceURI());
        if (namespaceURIIndex == KeyIntMap.NOT_PRESENT) {
            namespaceURIIndex = namespaceName.getSize();
            namespaceName.add(n.getNamespaceURI());
        }

        if (n.getPrefix().length() > 0) {
            prefixIndex = prefixMap.obtainIndex(n.getPrefix());
            if (prefixIndex == KeyIntMap.NOT_PRESENT) {
                prefixIndex = prefix.getSize();
                prefix.add(n.getPrefix());
            }
        }
    }

    int localNameIndex = localNameMap.obtainIndex(n.getLocalPart());
    if (localNameIndex == KeyIntMap.NOT_PRESENT) {
        localNameIndex = localName.getSize();
        localName.add(n.getLocalPart());
    }

    QualifiedName name = new QualifiedName(n.getPrefix(), n.getNamespaceURI(), n.getLocalPart(),
            a.getSize(),
            prefixIndex, namespaceURIIndex, localNameIndex);
    if (isAttribute) {
        name.createAttributeValues(DuplicateAttributeVerifier.MAP_SIZE);
    }
    a.add(name);
}
 
Example #16
Source File: Decoder.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
private void decodeTableItems(QualifiedNameArray array, boolean isAttribute) throws FastInfosetException, IOException {
    final int noOfItems = decodeNumberOfItemsOfSequence();

    for (int i = 0; i < noOfItems; i++) {
        final int b = read();

        String prefix = "";
        int prefixIndex = -1;
        if ((b & EncodingConstants.NAME_SURROGATE_PREFIX_FLAG) > 0) {
            prefixIndex = decodeIntegerIndexOnSecondBit();
            prefix = _v.prefix.get(prefixIndex);
        }

        String namespaceName = "";
        int namespaceNameIndex = -1;
        if ((b & EncodingConstants.NAME_SURROGATE_NAME_FLAG) > 0) {
            namespaceNameIndex = decodeIntegerIndexOnSecondBit();
            namespaceName = _v.namespaceName.get(namespaceNameIndex);
        }

        if (namespaceName == "" && prefix != "") {
            throw new FastInfosetException(CommonResourceBundle.getInstance().getString("message.missingNamespace"));
        }

        final int localNameIndex = decodeIntegerIndexOnSecondBit();
        final String localName = _v.localName.get(localNameIndex);

        QualifiedName qualifiedName = new QualifiedName(prefix, namespaceName, localName,
                prefixIndex, namespaceNameIndex, localNameIndex,
                _charBuffer);
        if (isAttribute) {
            qualifiedName.createAttributeValues(DuplicateAttributeVerifier.MAP_SIZE);
        }
        array.add(qualifiedName);
    }
}
 
Example #17
Source File: PrintTable.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public static void printArray(String title, QualifiedNameArray a) {
    System.out.println(title);

    for (int i = 0; i < a.getSize(); i++) {
        QualifiedName name = a.getArray()[i];
        System.out.println("" + (name.index + 1) + ": " +
                "{" + name.namespaceName + "}" +
                name.prefix + ":" + name.localName);
    }
}
 
Example #18
Source File: ParserVocabulary.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/** Creates a new instance of ParserVocabulary */
public ParserVocabulary() {
    namespaceName = new StringArray(ValueArray.DEFAULT_CAPACITY, IDENTIFYING_STRING_TABLE_MAXIMUM_ITEMS, false);
    prefix = new PrefixArray(ValueArray.DEFAULT_CAPACITY, IDENTIFYING_STRING_TABLE_MAXIMUM_ITEMS);
    localName = new StringArray(ValueArray.DEFAULT_CAPACITY, IDENTIFYING_STRING_TABLE_MAXIMUM_ITEMS, false);
    otherNCName = new StringArray(ValueArray.DEFAULT_CAPACITY, IDENTIFYING_STRING_TABLE_MAXIMUM_ITEMS, false);
    otherURI = new StringArray(ValueArray.DEFAULT_CAPACITY, IDENTIFYING_STRING_TABLE_MAXIMUM_ITEMS, true);
    attributeValue = new StringArray(ValueArray.DEFAULT_CAPACITY, NON_IDENTIFYING_STRING_TABLE_MAXIMUM_ITEMS, true);
    otherString = new CharArrayArray(ValueArray.DEFAULT_CAPACITY, NON_IDENTIFYING_STRING_TABLE_MAXIMUM_ITEMS);

    characterContentChunk = new ContiguousCharArrayArray(ValueArray.DEFAULT_CAPACITY,
            NON_IDENTIFYING_STRING_TABLE_MAXIMUM_ITEMS,
            ContiguousCharArrayArray.INITIAL_CHARACTER_SIZE,
            NON_IDENTIFYING_STRING_TABLE_MAXIMUM_CHARACTERS);

    elementName = new QualifiedNameArray(ValueArray.DEFAULT_CAPACITY, IDENTIFYING_STRING_TABLE_MAXIMUM_ITEMS);
    attributeName = new QualifiedNameArray(ValueArray.DEFAULT_CAPACITY, IDENTIFYING_STRING_TABLE_MAXIMUM_ITEMS);

    tables[RESTRICTED_ALPHABET] = restrictedAlphabet;
    tables[ENCODING_ALGORITHM] = encodingAlgorithm;
    tables[PREFIX] = prefix;
    tables[NAMESPACE_NAME] = namespaceName;
    tables[LOCAL_NAME] = localName;
    tables[OTHER_NCNAME] = otherNCName;
    tables[OTHER_URI] = otherURI;
    tables[ATTRIBUTE_VALUE] = attributeValue;
    tables[OTHER_STRING] = otherString;
    tables[CHARACTER_CONTENT_CHUNK] = characterContentChunk;
    tables[ELEMENT_NAME] = elementName;
    tables[ATTRIBUTE_NAME] = attributeName;
}
 
Example #19
Source File: ParserVocabulary.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private void addToTable(Iterator i, QualifiedNameArray a,
        boolean isAttribute,
        StringIntMap prefixMap, StringIntMap namespaceNameMap,
        StringIntMap localNameMap) {
    while (i.hasNext()) {
        addToNameTable((QName)i.next(), a, isAttribute,
                prefixMap, namespaceNameMap, localNameMap);
    }
}
 
Example #20
Source File: ParserVocabulary.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private void addToNameTable(QName n, QualifiedNameArray a,
        boolean isAttribute,
        StringIntMap prefixMap, StringIntMap namespaceNameMap,
        StringIntMap localNameMap) {
    int namespaceURIIndex = -1;
    int prefixIndex = -1;
    if (n.getNamespaceURI().length() > 0) {
        namespaceURIIndex = namespaceNameMap.obtainIndex(n.getNamespaceURI());
        if (namespaceURIIndex == KeyIntMap.NOT_PRESENT) {
            namespaceURIIndex = namespaceName.getSize();
            namespaceName.add(n.getNamespaceURI());
        }

        if (n.getPrefix().length() > 0) {
            prefixIndex = prefixMap.obtainIndex(n.getPrefix());
            if (prefixIndex == KeyIntMap.NOT_PRESENT) {
                prefixIndex = prefix.getSize();
                prefix.add(n.getPrefix());
            }
        }
    }

    int localNameIndex = localNameMap.obtainIndex(n.getLocalPart());
    if (localNameIndex == KeyIntMap.NOT_PRESENT) {
        localNameIndex = localName.getSize();
        localName.add(n.getLocalPart());
    }

    QualifiedName name = new QualifiedName(n.getPrefix(), n.getNamespaceURI(), n.getLocalPart(),
            a.getSize(),
            prefixIndex, namespaceURIIndex, localNameIndex);
    if (isAttribute) {
        name.createAttributeValues(DuplicateAttributeVerifier.MAP_SIZE);
    }
    a.add(name);
}
 
Example #21
Source File: Decoder.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private void decodeTableItems(QualifiedNameArray array, boolean isAttribute) throws FastInfosetException, IOException {
    final int noOfItems = decodeNumberOfItemsOfSequence();

    for (int i = 0; i < noOfItems; i++) {
        final int b = read();

        String prefix = "";
        int prefixIndex = -1;
        if ((b & EncodingConstants.NAME_SURROGATE_PREFIX_FLAG) > 0) {
            prefixIndex = decodeIntegerIndexOnSecondBit();
            prefix = _v.prefix.get(prefixIndex);
        }

        String namespaceName = "";
        int namespaceNameIndex = -1;
        if ((b & EncodingConstants.NAME_SURROGATE_NAME_FLAG) > 0) {
            namespaceNameIndex = decodeIntegerIndexOnSecondBit();
            namespaceName = _v.namespaceName.get(namespaceNameIndex);
        }

        if (namespaceName == "" && prefix != "") {
            throw new FastInfosetException(CommonResourceBundle.getInstance().getString("message.missingNamespace"));
        }

        final int localNameIndex = decodeIntegerIndexOnSecondBit();
        final String localName = _v.localName.get(localNameIndex);

        QualifiedName qualifiedName = new QualifiedName(prefix, namespaceName, localName,
                prefixIndex, namespaceNameIndex, localNameIndex,
                _charBuffer);
        if (isAttribute) {
            qualifiedName.createAttributeValues(DuplicateAttributeVerifier.MAP_SIZE);
        }
        array.add(qualifiedName);
    }
}
 
Example #22
Source File: PrintTable.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public static void printArray(String title, QualifiedNameArray a) {
    System.out.println(title);

    for (int i = 0; i < a.getSize(); i++) {
        QualifiedName name = a.getArray()[i];
        System.out.println("" + (name.index + 1) + ": " +
                "{" + name.namespaceName + "}" +
                name.prefix + ":" + name.localName);
    }
}
 
Example #23
Source File: PrintTable.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public static void printArray(String title, QualifiedNameArray a) {
    System.out.println(title);

    for (int i = 0; i < a.getSize(); i++) {
        QualifiedName name = a.getArray()[i];
        System.out.println("" + (name.index + 1) + ": " +
                "{" + name.namespaceName + "}" +
                name.prefix + ":" + name.localName);
    }
}
 
Example #24
Source File: ParserVocabulary.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private void addToTable(Iterator i, QualifiedNameArray a,
        boolean isAttribute,
        StringIntMap prefixMap, StringIntMap namespaceNameMap,
        StringIntMap localNameMap) {
    while (i.hasNext()) {
        addToNameTable((QName)i.next(), a, isAttribute,
                prefixMap, namespaceNameMap, localNameMap);
    }
}
 
Example #25
Source File: ParserVocabulary.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private void addToNameTable(QName n, QualifiedNameArray a,
        boolean isAttribute,
        StringIntMap prefixMap, StringIntMap namespaceNameMap,
        StringIntMap localNameMap) {
    int namespaceURIIndex = -1;
    int prefixIndex = -1;
    if (n.getNamespaceURI().length() > 0) {
        namespaceURIIndex = namespaceNameMap.obtainIndex(n.getNamespaceURI());
        if (namespaceURIIndex == KeyIntMap.NOT_PRESENT) {
            namespaceURIIndex = namespaceName.getSize();
            namespaceName.add(n.getNamespaceURI());
        }

        if (n.getPrefix().length() > 0) {
            prefixIndex = prefixMap.obtainIndex(n.getPrefix());
            if (prefixIndex == KeyIntMap.NOT_PRESENT) {
                prefixIndex = prefix.getSize();
                prefix.add(n.getPrefix());
            }
        }
    }

    int localNameIndex = localNameMap.obtainIndex(n.getLocalPart());
    if (localNameIndex == KeyIntMap.NOT_PRESENT) {
        localNameIndex = localName.getSize();
        localName.add(n.getLocalPart());
    }

    QualifiedName name = new QualifiedName(n.getPrefix(), n.getNamespaceURI(), n.getLocalPart(),
            a.getSize(),
            prefixIndex, namespaceURIIndex, localNameIndex);
    if (isAttribute) {
        name.createAttributeValues(DuplicateAttributeVerifier.MAP_SIZE);
    }
    a.add(name);
}
 
Example #26
Source File: Decoder.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private void decodeTableItems(QualifiedNameArray array, boolean isAttribute) throws FastInfosetException, IOException {
    final int noOfItems = decodeNumberOfItemsOfSequence();

    for (int i = 0; i < noOfItems; i++) {
        final int b = read();

        String prefix = "";
        int prefixIndex = -1;
        if ((b & EncodingConstants.NAME_SURROGATE_PREFIX_FLAG) > 0) {
            prefixIndex = decodeIntegerIndexOnSecondBit();
            prefix = _v.prefix.get(prefixIndex);
        }

        String namespaceName = "";
        int namespaceNameIndex = -1;
        if ((b & EncodingConstants.NAME_SURROGATE_NAME_FLAG) > 0) {
            namespaceNameIndex = decodeIntegerIndexOnSecondBit();
            namespaceName = _v.namespaceName.get(namespaceNameIndex);
        }

        if (namespaceName == "" && prefix != "") {
            throw new FastInfosetException(CommonResourceBundle.getInstance().getString("message.missingNamespace"));
        }

        final int localNameIndex = decodeIntegerIndexOnSecondBit();
        final String localName = _v.localName.get(localNameIndex);

        QualifiedName qualifiedName = new QualifiedName(prefix, namespaceName, localName,
                prefixIndex, namespaceNameIndex, localNameIndex,
                _charBuffer);
        if (isAttribute) {
            qualifiedName.createAttributeValues(DuplicateAttributeVerifier.MAP_SIZE);
        }
        array.add(qualifiedName);
    }
}
 
Example #27
Source File: PrintTable.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public static void printArray(String title, QualifiedNameArray a) {
    System.out.println(title);

    for (int i = 0; i < a.getSize(); i++) {
        QualifiedName name = a.getArray()[i];
        System.out.println("" + (name.index + 1) + ": " +
                "{" + name.namespaceName + "}" +
                name.prefix + ":" + name.localName);
    }
}
 
Example #28
Source File: ParserVocabulary.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/** Creates a new instance of ParserVocabulary */
public ParserVocabulary() {
    namespaceName = new StringArray(ValueArray.DEFAULT_CAPACITY, IDENTIFYING_STRING_TABLE_MAXIMUM_ITEMS, false);
    prefix = new PrefixArray(ValueArray.DEFAULT_CAPACITY, IDENTIFYING_STRING_TABLE_MAXIMUM_ITEMS);
    localName = new StringArray(ValueArray.DEFAULT_CAPACITY, IDENTIFYING_STRING_TABLE_MAXIMUM_ITEMS, false);
    otherNCName = new StringArray(ValueArray.DEFAULT_CAPACITY, IDENTIFYING_STRING_TABLE_MAXIMUM_ITEMS, false);
    otherURI = new StringArray(ValueArray.DEFAULT_CAPACITY, IDENTIFYING_STRING_TABLE_MAXIMUM_ITEMS, true);
    attributeValue = new StringArray(ValueArray.DEFAULT_CAPACITY, NON_IDENTIFYING_STRING_TABLE_MAXIMUM_ITEMS, true);
    otherString = new CharArrayArray(ValueArray.DEFAULT_CAPACITY, NON_IDENTIFYING_STRING_TABLE_MAXIMUM_ITEMS);

    characterContentChunk = new ContiguousCharArrayArray(ValueArray.DEFAULT_CAPACITY,
            NON_IDENTIFYING_STRING_TABLE_MAXIMUM_ITEMS,
            ContiguousCharArrayArray.INITIAL_CHARACTER_SIZE,
            NON_IDENTIFYING_STRING_TABLE_MAXIMUM_CHARACTERS);

    elementName = new QualifiedNameArray(ValueArray.DEFAULT_CAPACITY, IDENTIFYING_STRING_TABLE_MAXIMUM_ITEMS);
    attributeName = new QualifiedNameArray(ValueArray.DEFAULT_CAPACITY, IDENTIFYING_STRING_TABLE_MAXIMUM_ITEMS);

    tables[RESTRICTED_ALPHABET] = restrictedAlphabet;
    tables[ENCODING_ALGORITHM] = encodingAlgorithm;
    tables[PREFIX] = prefix;
    tables[NAMESPACE_NAME] = namespaceName;
    tables[LOCAL_NAME] = localName;
    tables[OTHER_NCNAME] = otherNCName;
    tables[OTHER_URI] = otherURI;
    tables[ATTRIBUTE_VALUE] = attributeValue;
    tables[OTHER_STRING] = otherString;
    tables[CHARACTER_CONTENT_CHUNK] = characterContentChunk;
    tables[ELEMENT_NAME] = elementName;
    tables[ATTRIBUTE_NAME] = attributeName;
}
 
Example #29
Source File: ParserVocabulary.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
private void addToTable(Iterator i, QualifiedNameArray a,
        boolean isAttribute,
        StringIntMap prefixMap, StringIntMap namespaceNameMap,
        StringIntMap localNameMap) {
    while (i.hasNext()) {
        addToNameTable((QName)i.next(), a, isAttribute,
                prefixMap, namespaceNameMap, localNameMap);
    }
}
 
Example #30
Source File: ParserVocabulary.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
private void addToNameTable(QName n, QualifiedNameArray a,
        boolean isAttribute,
        StringIntMap prefixMap, StringIntMap namespaceNameMap,
        StringIntMap localNameMap) {
    int namespaceURIIndex = -1;
    int prefixIndex = -1;
    if (n.getNamespaceURI().length() > 0) {
        namespaceURIIndex = namespaceNameMap.obtainIndex(n.getNamespaceURI());
        if (namespaceURIIndex == KeyIntMap.NOT_PRESENT) {
            namespaceURIIndex = namespaceName.getSize();
            namespaceName.add(n.getNamespaceURI());
        }

        if (n.getPrefix().length() > 0) {
            prefixIndex = prefixMap.obtainIndex(n.getPrefix());
            if (prefixIndex == KeyIntMap.NOT_PRESENT) {
                prefixIndex = prefix.getSize();
                prefix.add(n.getPrefix());
            }
        }
    }

    int localNameIndex = localNameMap.obtainIndex(n.getLocalPart());
    if (localNameIndex == KeyIntMap.NOT_PRESENT) {
        localNameIndex = localName.getSize();
        localName.add(n.getLocalPart());
    }

    QualifiedName name = new QualifiedName(n.getPrefix(), n.getNamespaceURI(), n.getLocalPart(),
            a.getSize(),
            prefixIndex, namespaceURIIndex, localNameIndex);
    if (isAttribute) {
        name.createAttributeValues(DuplicateAttributeVerifier.MAP_SIZE);
    }
    a.add(name);
}