Package nu.validator.htmlparser.impl

Examples of nu.validator.htmlparser.impl.UTF16Buffer


       
                lastWasCR = false;
                ending = false;
                documentWriteBuffer.setLength(0);
                streamLength = source.length();
                stream = new UTF16Buffer(source.toCharArray(), 0,
                        (streamLength < CHUNK_SIZE ? streamLength : CHUNK_SIZE));
                bufferStack.clear();
                push(stream);
                domTreeBuilder.setFragmentContext(context == null ? null : context.intern());
               
View Full Code Here


        int docWriteLen = documentWriteBuffer.length();
        if (docWriteLen > 0) {
            char[] newBuf = new char[docWriteLen];
            documentWriteBuffer.getChars(0, docWriteLen, newBuf, 0);
            push(new UTF16Buffer(newBuf, 0, docWriteLen));
            documentWriteBuffer.setLength(0);
        }

        for (;;) {
            UTF16Buffer buffer = peek();
            if (!buffer.hasMore()) {
                if (buffer == stream) {
                    if (buffer.getEnd() == streamLength) {
                        // Stop parsing
                        tokenizer.eof();
                        ending = true;
                        break;
                    } else {
                        int newEnd = buffer.getStart() + CHUNK_SIZE;
                        buffer.setEnd(newEnd < streamLength ? newEnd
                                : streamLength);
                        continue;
                    }
                } else {
                    pop();
                    continue;
                }
            }
            // now we have a non-empty buffer
            buffer.adjust(lastWasCR);
            lastWasCR = false;
            if (buffer.hasMore()) {
                lastWasCR = tokenizer.tokenizeBuffer(buffer);
                domTreeBuilder.maybeRunScript();
                break;
            } else {
                continue;
View Full Code Here

        bufferStack.removeLast();
    }

    public void documentWrite(final String text) throws SAXException {

      UTF16Buffer buffer = new UTF16Buffer(text.toCharArray(), 0, text.length());
      while (buffer.hasMore()) {
          buffer.adjust(lastWasCR);
          lastWasCR = false;
          if (buffer.hasMore()) {
              lastWasCR = tokenizer.tokenizeBuffer(buffer);           
              domTreeBuilder.maybeRunScript();
          }
      }
    }
View Full Code Here

       
                lastWasCR = false;
                ending = false;
                documentWriteBuffer.setLength(0);
                streamLength = source.length();
                stream = new UTF16Buffer(source.toCharArray(), 0,
                        (streamLength < CHUNK_SIZE ? streamLength : CHUNK_SIZE));
                bufferStack.clear();
                push(stream);
                domTreeBuilder.setFragmentContext(context == null ? null : context.intern());
               
View Full Code Here

        int docWriteLen = documentWriteBuffer.length();
        if (docWriteLen > 0) {
            char[] newBuf = new char[docWriteLen];
            documentWriteBuffer.getChars(0, docWriteLen, newBuf, 0);
            push(new UTF16Buffer(newBuf, 0, docWriteLen));
            documentWriteBuffer.setLength(0);
        }

        for (;;) {
            UTF16Buffer buffer = peek();
            if (!buffer.hasMore()) {
                if (buffer == stream) {
                    if (buffer.getEnd() == streamLength) {
                        // Stop parsing
                        tokenizer.eof();
                        ending = true;
                        break;
                    } else {
                        int newEnd = buffer.getStart() + CHUNK_SIZE;
                        buffer.setEnd(newEnd < streamLength ? newEnd
                                : streamLength);
                        continue;
                    }
                } else {
                    pop();
                    continue;
                }
            }
            // now we have a non-empty buffer
            buffer.adjust(lastWasCR);
            lastWasCR = false;
            if (buffer.hasMore()) {
                lastWasCR = tokenizer.tokenizeBuffer(buffer);
                domTreeBuilder.maybeRunScript();
                break;
            } else {
                continue;
View Full Code Here

        bufferStack.removeLast();
    }

    public void documentWrite(final String text) throws SAXException {

      UTF16Buffer buffer = new UTF16Buffer(text.toCharArray(), 0, text.length());
      while (buffer.hasMore()) {
          buffer.adjust(lastWasCR);
          lastWasCR = false;
          if (buffer.hasMore()) {
              lastWasCR = tokenizer.tokenizeBuffer(buffer);           
              domTreeBuilder.maybeRunScript();
          }
      }
    }
View Full Code Here

        swallowBom = false;
    }

    private void runStates() throws SAXException, IOException {
        char[] buffer = new char[2048];
        UTF16Buffer bufr = new UTF16Buffer(buffer, 0, 0);
        boolean lastWasCR = false;
        int len = -1;
        if ((len = reader.read(buffer)) != -1) {
            assert len > 0;
            int streamOffset = 0;
            int offset = 0;
            int length = len;
            if (swallowBom) {
                if (buffer[0] == '\uFEFF') {
                    streamOffset = -1;
                    offset = 1;
                    length--;
                }
            }
            if (length > 0) {
                for (int i = 0; i < characterHandlers.length; i++) {
                    CharacterHandler ch = characterHandlers[i];
                    ch.characters(buffer, offset, length);
                }
                tokenizer.setTransitionBaseOffset(streamOffset);
                bufr.setStart(offset);
                bufr.setEnd(offset + length);
                while (bufr.hasMore()) {
                    bufr.adjust(lastWasCR);
                    lastWasCR = false;
                    if (bufr.hasMore()) {
                        lastWasCR = tokenizer.tokenizeBuffer(bufr);                   
                    }
                }
            }
            streamOffset = length;
            while ((len = reader.read(buffer)) != -1) {
                assert len > 0;
                for (int i = 0; i < characterHandlers.length; i++) {
                    CharacterHandler ch = characterHandlers[i];
                    ch.characters(buffer, 0, len);
                }
                tokenizer.setTransitionBaseOffset(streamOffset);
                bufr.setStart(0);
                bufr.setEnd(len);
                while (bufr.hasMore()) {
                    bufr.adjust(lastWasCR);
                    lastWasCR = false;
                    if (bufr.hasMore()) {
                        lastWasCR = tokenizer.tokenizeBuffer(bufr);                   
                    }
                }
                streamOffset += len;
            }
View Full Code Here

        swallowBom = false;
    }

    private void runStates() throws SAXException, IOException {
        char[] buffer = new char[2048];
        UTF16Buffer bufr = new UTF16Buffer(buffer, 0, 0);
        boolean lastWasCR = false;
        int len = -1;
        if ((len = reader.read(buffer)) != -1) {
            assert len > 0;
            int streamOffset = 0;
            int offset = 0;
            int length = len;
            if (swallowBom) {
                if (buffer[0] == '\uFEFF') {
                    streamOffset = -1;
                    offset = 1;
                    length--;
                }
            }
            if (length > 0) {
                for (int i = 0; i < characterHandlers.length; i++) {
                    CharacterHandler ch = characterHandlers[i];
                    ch.characters(buffer, offset, length);
                }
                tokenizer.setTransitionBaseOffset(streamOffset);
                bufr.setStart(offset);
                bufr.setEnd(offset + length);
                while (bufr.hasMore()) {
                    bufr.adjust(lastWasCR);
                    lastWasCR = false;
                    if (bufr.hasMore()) {
                        lastWasCR = tokenizer.tokenizeBuffer(bufr);                   
                    }
                }
            }
            streamOffset = length;
            while ((len = reader.read(buffer)) != -1) {
                assert len > 0;
                for (int i = 0; i < characterHandlers.length; i++) {
                    CharacterHandler ch = characterHandlers[i];
                    ch.characters(buffer, 0, len);
                }
                tokenizer.setTransitionBaseOffset(streamOffset);
                bufr.setStart(0);
                bufr.setEnd(len);
                while (bufr.hasMore()) {
                    bufr.adjust(lastWasCR);
                    lastWasCR = false;
                    if (bufr.hasMore()) {
                        lastWasCR = tokenizer.tokenizeBuffer(bufr);                   
                    }
                }
                streamOffset += len;
            }
View Full Code Here

        swallowBom = false;
    }

    private void runStates() throws SAXException, IOException {
        char[] buffer = new char[2048];
        UTF16Buffer bufr = new UTF16Buffer(buffer, 0, 0);
        boolean lastWasCR = false;
        int len = -1;
        if ((len = reader.read(buffer)) != -1) {
            assert len > 0;
            int offset = 0;
            int length = len;
            if (swallowBom) {
                if (buffer[0] == '\uFEFF') {
                    offset = 1;
                    length--;
                }
            }
            if (length > 0) {
                for (int i = 0; i < characterHandlers.length; i++) {
                    CharacterHandler ch = characterHandlers[i];
                    ch.characters(buffer, offset, length);
                }
                bufr.setStart(offset);
                bufr.setEnd(offset + length);
                while (bufr.hasMore()) {
                    bufr.adjust(lastWasCR);
                    lastWasCR = false;
                    if (bufr.hasMore()) {
                        lastWasCR = tokenizer.tokenizeBuffer(bufr);                   
                    }
                }
            }
            while ((len = reader.read(buffer)) != -1) {
                assert len > 0;
                for (int i = 0; i < characterHandlers.length; i++) {
                    CharacterHandler ch = characterHandlers[i];
                    ch.characters(buffer, 0, len);
                }
                bufr.setStart(0);
                bufr.setEnd(len);
                while (bufr.hasMore()) {
                    bufr.adjust(lastWasCR);
                    lastWasCR = false;
                    if (bufr.hasMore()) {
                        lastWasCR = tokenizer.tokenizeBuffer(bufr);                   
                    }
                }
            }
        }
View Full Code Here

TOP

Related Classes of nu.validator.htmlparser.impl.UTF16Buffer

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.