Java Code Examples for com.sun.xml.internal.fastinfoset.EncodingConstants#ENCODING_ALGORITHM_BUILTIN_END

The following examples show how to use com.sun.xml.internal.fastinfoset.EncodingConstants#ENCODING_ALGORITHM_BUILTIN_END . 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: DOMDocumentParser.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
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();
}
 
Example 2
Source File: StAXDocumentParser.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
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);
    }
}
 
Example 3
Source File: StAXDocumentParser.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
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);
    }
}
 
Example 4
Source File: DOMDocumentParser.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
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();
}
 
Example 5
Source File: StAXDocumentParser.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
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);
    }
}
 
Example 6
Source File: DOMDocumentParser.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
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();
}
 
Example 7
Source File: DOMDocumentParser.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
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();
}
 
Example 8
Source File: StAXDocumentParser.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
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);
    }
}
 
Example 9
Source File: DOMDocumentParser.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
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();
}
 
Example 10
Source File: DOMDocumentParser.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
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();
}
 
Example 11
Source File: StAXDocumentParser.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
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);
    }
}
 
Example 12
Source File: DOMDocumentParser.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
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();
}
 
Example 13
Source File: StAXDocumentParser.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
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);
    }
}
 
Example 14
Source File: StAXDocumentParser.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example 15
Source File: StAXDocumentParser.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example 16
Source File: StAXDocumentParser.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example 17
Source File: StAXDocumentParser.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example 18
Source File: StAXDocumentParser.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example 19
Source File: StAXDocumentParser.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example 20
Source File: StAXDocumentParser.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
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;
}