Package javolution.text

Examples of javolution.text.CharArray


        if (getEventType() != XMLStreamConstants.START_ELEMENT) {
            throw new XMLStreamException(
                    "Parser must be on START_ELEMENT to read next text",
                    getLocation());
        }
        CharArray text = null;
        int eventType = next();
        while (eventType != XMLStreamConstants.END_ELEMENT) {
            if (eventType == XMLStreamConstants.CHARACTERS) {
                if (text == null) {
                    text = getText();
                } else { // Merge (adjacent text, comments and PI are not kept).
                    text.setArray(_data, text.offset(), text.length()
                            + getText().length());
                }
            } else if (eventType == XMLStreamConstants.PROCESSING_INSTRUCTION
                    || eventType == XMLStreamConstants.COMMENT) {
                // Skips (not kept).
View Full Code Here


    }

    public CharArray getAttributeNamespace(int index) {
        if (_eventType != XMLStreamConstants.START_ELEMENT)
            throw illegalState("Not a start element");
        CharArray prefix = _attributes.getPrefix(index);
        return _namespaces.getNamespaceURINullAllowed(prefix);
    }
View Full Code Here

        if ((_eventType != XMLStreamConstants.START_ELEMENT)
                && (_eventType != XMLStreamConstants.END_ELEMENT))
            throw illegalState("Not a start or end element");
        if (_prefixSep < 0)
            return _qName;
        CharArray localName = newSeq(_prefixSep + 1, _qName.offset()
                + _qName.length() - _prefixSep - 1);
        return localName;
    }
View Full Code Here

                && (_eventType != XMLStreamConstants.END_ELEMENT))
            throw illegalState("Not a start or end element");
        if (_prefixSep < 0)
            return null;
        int offset = _qName.offset();
        CharArray prefix = newSeq(offset, _prefixSep - offset);
        return prefix;
    }
View Full Code Here

            throw new SAXException("Currently parsing");
        _contentHandler.startDocument();

        boolean doContinue = true;
        while (doContinue) {
            CharArray uri, localName, qName, prefix, text;
            switch (_xmlReader.next()) {
            case XMLStreamConstants.START_ELEMENT:

                // Start prefix mapping.
                for (int i = 0, count = _xmlReader.getNamespaceCount(); i < count; i++) {
View Full Code Here

    public CharArray getPIData() {
        if (_eventType != XMLStreamConstants.PROCESSING_INSTRUCTION)
            throw illegalState("Not a processing instruction");
        int offset = _text.indexOf(' ') + _text.offset() + 1;
        CharArray piData = newSeq(offset, _text.length() - offset);
        return piData;
    }
View Full Code Here

    }

    public CharArray getPITarget() {
        if (_eventType != XMLStreamConstants.PROCESSING_INSTRUCTION)
            throw illegalState("Not a processing instruction");
        CharArray piTarget = newSeq(_text.offset(), _text.indexOf(' ') + _text.offset());
        return piTarget;
    }
View Full Code Here

        return getText().array();
    }

    public int getTextCharacters(int sourceStart, char[] target,
            int targetStart, int length) throws XMLStreamException {
        CharArray text = getText();
        int copyLength = Math.min(length, text.length());
        System.arraycopy(text.array(), sourceStart + text.offset(), target,
                targetStart, copyLength);
        return copyLength;
    }
View Full Code Here

    }

    private static final CharArray VERSION = new CharArray("version");

    public boolean isStandalone() {
        CharArray standalone = readPrologAttribute(STANDALONE);
        return (standalone != null) ? standalone.equals("no") : true;
    }
View Full Code Here

            txt.getChars(_index, _index + count, cbuf, off);
        } else if (csq instanceof TextBuilder) {
            TextBuilder tb = (TextBuilder) csq;
            tb.getChars(_index, _index + count, cbuf, off);
        } else if (csq instanceof CharArray) {
            CharArray ca = (CharArray) csq;
            System
                    .arraycopy(ca.array(), _index + ca.offset(), cbuf, off,
                            count);
        } else { // Generic CharSequence.
            for (int i = off, n = off + count, j = _index; i < n;) {
                cbuf[i++] = _input.charAt(j++);
            }
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.