Package javolution.text

Examples of javolution.text.CharArray


         * @return the <code>long</code> value for the specified attribute or
         *         the default value if the attribute is not found.
         */
        public long getAttribute(String name, long defaultValue)
                throws XMLStreamException {
            CharArray value = getAttribute(name);
            return (value != null) ? value.toLong() : defaultValue;
        }
View Full Code Here


         * @return the <code>float</code> value for the specified attribute or
         *         the default value if the attribute is not found.
         */
        public float getAttribute(String name, float defaultValue)
                throws XMLStreamException {
            CharArray value = getAttribute(name);
            return (value != null) ? value.toFloat() : defaultValue;
        }
View Full Code Here

         * @return the <code>double</code> value for the specified attribute or
         *         the default value if the attribute is not found.
         */
        public double getAttribute(String name, double defaultValue)
                throws XMLStreamException {
            CharArray value = getAttribute(name);
            return (value != null) ? value.toDouble() : defaultValue;
        }
View Full Code Here

         * @return the parse value for the specified attribute or
         *         the default value if the attribute is not found.
         */
        public <T>   T  getAttribute(String name,
                 T  defaultValue) throws XMLStreamException {
            CharArray value = getAttribute(name);
            if (value == null)
                return defaultValue;
            // Parses attribute value.
            Class type = defaultValue.getClass();
            TextFormat format = TextFormat.getInstance(type);
View Full Code Here

     *
     * @param  in the input source with unknown encoding.
     */
    public void setInput(InputStream in) throws XMLStreamException {
        setInput(in, detectEncoding(in));
        CharArray prologEncoding = getCharacterEncodingScheme();

        // Checks if necessary to change the reader.
        if ((prologEncoding != null) && !prologEncoding.equals(_encoding)
                && !(isUTF8(prologEncoding) && isUTF8(_encoding))) {
            // Changes reader (keep characters already read).
            int startOffset = _readCount;
            reset();
            _startOffset = startOffset;
            setInput(in, prologEncoding.toString());
        }
    }
View Full Code Here

                _isEmpty = false;
                return _eventType = END_ELEMENT;
            }
        } else if (_eventType == END_ELEMENT) {
            _namespaces.pop();
            CharArray startElem = _elemStack[_depth--];
            _start = _index = startElem.offset();
            while (_seqs[--_seqsIndex] != startElem) { // Recycles CharArray instances.
            }
        }
        // Reader loop.
        while (true) {
View Full Code Here

            }
        } else { // Prefix.
            final int offset = _attrQName.offset();
            final int length = _attrQName.length();

            CharArray prefix = newSeq(offset, _attrPrefixSep - offset);

            CharArray localName = newSeq(_attrPrefixSep + 1, offset + length
                    - _attrPrefixSep - 1);

            if (isXMLNS(prefix)) { // Namespace association.
                _namespaces.setPrefix(localName, _attrValue);
            } else {
View Full Code Here

        _utf8StreamReader.reset();
    }

    // Returns a new character sequence from the pool.
    private CharArray newSeq(int offset, int length) {
        CharArray seq = (_seqsIndex < _seqsCapacity) ? _seqs[_seqsIndex++]
                : newSeq2();
        return seq.setArray(_data, offset, length);
    }
View Full Code Here

        //       numerous elements at the same nesting level are separated by
        //       spaces or indentation.
        MemoryArea.getMemoryArea(this).executeInArea(new Runnable() {
            public void run() {
                char[] tmp = new char[_data.length * 2];
                javolution.context.LogContext.info(new CharArray(
                        "XMLStreamReaderImpl: Data buffer increased to "
                                + tmp.length));
                System.arraycopy(_data, 0, tmp, 0, _data.length);
                _data = tmp;
            }
View Full Code Here

    // Increases statck.
    private void increaseStack() {
        MemoryArea.getMemoryArea(this).executeInArea(new Runnable() {
            public void run() {
                CharArray[] tmp = new CharArray[_elemStack.length * 2];
                javolution.context.LogContext.info(new CharArray(
                        "XMLStreamReaderImpl: CharArray stack increased to "
                                + tmp.length));
                System.arraycopy(_elemStack, 0, tmp, 0, _elemStack.length);
                _elemStack = tmp;
            }
View Full Code Here

TOP

Related Classes of javolution.text.CharArray

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.