Java Code Examples for com.sun.xml.internal.bind.WhiteSpaceProcessor#isWhiteSpace()

The following examples show how to use com.sun.xml.internal.bind.WhiteSpaceProcessor#isWhiteSpace() . 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: ListTransducedAccessorImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
private void processValue(BeanT bean, CharSequence s) throws AccessorException, SAXException {
    PackT pack = lister.startPacking(bean,acc);

    int idx = 0;
    int len = s.length();

    while(true) {
        int p = idx;
        while( p<len && !WhiteSpaceProcessor.isWhiteSpace(s.charAt(p)) )
            p++;

        CharSequence token = s.subSequence(idx,p);
        if (!token.equals(""))
            lister.addToPack(pack,xducer.parse(token));

        if(p==len)      break;  // done

        while( p<len && WhiteSpaceProcessor.isWhiteSpace(s.charAt(p)) )
            p++;
        if(p==len)      break;  // done

        idx = p;
    }

    lister.endPacking(pack,bean,acc);
}
 
Example 2
Source File: ListTransducedAccessorImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
private void processValue(BeanT bean, CharSequence s) throws AccessorException, SAXException {
    PackT pack = lister.startPacking(bean,acc);

    int idx = 0;
    int len = s.length();

    while(true) {
        int p = idx;
        while( p<len && !WhiteSpaceProcessor.isWhiteSpace(s.charAt(p)) )
            p++;

        CharSequence token = s.subSequence(idx,p);
        if (!token.equals(""))
            lister.addToPack(pack,xducer.parse(token));

        if(p==len)      break;  // done

        while( p<len && WhiteSpaceProcessor.isWhiteSpace(s.charAt(p)) )
            p++;
        if(p==len)      break;  // done

        idx = p;
    }

    lister.endPacking(pack,bean,acc);
}
 
Example 3
Source File: FastInfosetConnector.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
private void processIgnorableText() throws SAXException {
    boolean isTextAlgorithmAplied =
            (fastInfosetStreamReader.getTextAlgorithmBytes() != null);

    if (isTextAlgorithmAplied &&
            fastInfosetStreamReader.getTextAlgorithmIndex() == EncodingAlgorithmIndexes.BASE64) {
        base64Data.set(fastInfosetStreamReader.getTextAlgorithmBytesClone(),null);
        visitor.text(base64Data);
        textReported = true;
    } else {
        if (isTextAlgorithmAplied) {
            fastInfosetStreamReader.getText();
        }

        charArray.set();
        if (!WhiteSpaceProcessor.isWhiteSpace(charArray)) {
            visitor.text(charArray);
            textReported = true;
        }
    }
}
 
Example 4
Source File: ListTransducedAccessorImpl.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
private void processValue(BeanT bean, CharSequence s) throws AccessorException, SAXException {
    PackT pack = lister.startPacking(bean,acc);

    int idx = 0;
    int len = s.length();

    while(true) {
        int p = idx;
        while( p<len && !WhiteSpaceProcessor.isWhiteSpace(s.charAt(p)) )
            p++;

        CharSequence token = s.subSequence(idx,p);
        if (!token.equals(""))
            lister.addToPack(pack,xducer.parse(token));

        if(p==len)      break;  // done

        while( p<len && WhiteSpaceProcessor.isWhiteSpace(s.charAt(p)) )
            p++;
        if(p==len)      break;  // done

        idx = p;
    }

    lister.endPacking(pack,bean,acc);
}
 
Example 5
Source File: FastInfosetConnector.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
private void processIgnorableText() throws SAXException {
    boolean isTextAlgorithmAplied =
            (fastInfosetStreamReader.getTextAlgorithmBytes() != null);

    if (isTextAlgorithmAplied &&
            fastInfosetStreamReader.getTextAlgorithmIndex() == EncodingAlgorithmIndexes.BASE64) {
        base64Data.set(fastInfosetStreamReader.getTextAlgorithmBytesClone(),null);
        visitor.text(base64Data);
        textReported = true;
    } else {
        if (isTextAlgorithmAplied) {
            fastInfosetStreamReader.getText();
        }

        charArray.set();
        if (!WhiteSpaceProcessor.isWhiteSpace(charArray)) {
            visitor.text(charArray);
            textReported = true;
        }
    }
}
 
Example 6
Source File: FastInfosetConnector.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
private void processIgnorableText() throws SAXException {
    boolean isTextAlgorithmAplied =
            (fastInfosetStreamReader.getTextAlgorithmBytes() != null);

    if (isTextAlgorithmAplied &&
            fastInfosetStreamReader.getTextAlgorithmIndex() == EncodingAlgorithmIndexes.BASE64) {
        base64Data.set(fastInfosetStreamReader.getTextAlgorithmBytesClone(),null);
        visitor.text(base64Data);
        textReported = true;
    } else {
        if (isTextAlgorithmAplied) {
            fastInfosetStreamReader.getText();
        }

        charArray.set();
        if (!WhiteSpaceProcessor.isWhiteSpace(charArray)) {
            visitor.text(charArray);
            textReported = true;
        }
    }
}
 
Example 7
Source File: WhitespaceStripper.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Forwars the buffered characters if it contains any non-whitespace
 * character.
 */
private void processPendingText() throws SAXException {
    if(state==AFTER_START_ELEMENT) {
        for( int i=bufLen-1; i>=0; i-- )
            if( !WhiteSpaceProcessor.isWhiteSpace(buf[i]) ) {
                super.characters(buf, 0, bufLen);
                return;
           }
    }
}
 
Example 8
Source File: StAXStreamConnector.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private void processText( boolean ignorable ) throws SAXException {
    if( predictor.expectText() && (!ignorable || !WhiteSpaceProcessor.isWhiteSpace(buffer) || context.getCurrentState().isMixed())) {
        if(textReported) {
            textReported = false;
        } else {
            visitor.text(buffer);
        }
    }
    buffer.setLength(0);
}
 
Example 9
Source File: WhitespaceStripper.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Forwars the buffered characters if it contains any non-whitespace
 * character.
 */
private void processPendingText() throws SAXException {
    if(state==AFTER_START_ELEMENT) {
        for( int i=bufLen-1; i>=0; i-- )
            if( !WhiteSpaceProcessor.isWhiteSpace(buf[i]) ) {
                super.characters(buf, 0, bufLen);
                return;
           }
    }
}
 
Example 10
Source File: WhitespaceStripper.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Forwars the buffered characters if it contains any non-whitespace
 * character.
 */
private void processPendingText() throws SAXException {
    if(state==AFTER_START_ELEMENT) {
        for( int i=bufLen-1; i>=0; i-- )
            if( !WhiteSpaceProcessor.isWhiteSpace(buf[i]) ) {
                super.characters(buf, 0, bufLen);
                return;
           }
    }
}
 
Example 11
Source File: WhitespaceStripper.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public void characters(char[] ch, int start, int length) throws SAXException {
    switch(state) {
    case AFTER_START_ELEMENT:
        // we have to store the characters here, even if it consists entirely
        // of whitespaces. This is because successive characters event might
        // include non-whitespace char, in which case all the whitespaces in
        // this event may suddenly become significant.
        if( bufLen+length>buf.length ) {
            // reallocate buffer
            char[] newBuf = new char[Math.max(bufLen+length,buf.length*2)];
            System.arraycopy(buf,0,newBuf,0,bufLen);
            buf = newBuf;
        }
        System.arraycopy(ch,start,buf,bufLen,length);
        bufLen += length;
        break;
    case AFTER_END_ELEMENT:
        // check if this is ignorable.
        int len = start+length;
        for( int i=start; i<len; i++ )
            if( !WhiteSpaceProcessor.isWhiteSpace(ch[i]) ) {
                super.characters(ch, start, length);
                return;
            }
        // if it's entirely whitespace, ignore it.
        break;
    }
}
 
Example 12
Source File: WhitespaceStripper.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public void characters(char[] ch, int start, int length) throws SAXException {
    switch(state) {
    case AFTER_START_ELEMENT:
        // we have to store the characters here, even if it consists entirely
        // of whitespaces. This is because successive characters event might
        // include non-whitespace char, in which case all the whitespaces in
        // this event may suddenly become significant.
        if( bufLen+length>buf.length ) {
            // reallocate buffer
            char[] newBuf = new char[Math.max(bufLen+length,buf.length*2)];
            System.arraycopy(buf,0,newBuf,0,bufLen);
            buf = newBuf;
        }
        System.arraycopy(ch,start,buf,bufLen,length);
        bufLen += length;
        break;
    case AFTER_END_ELEMENT:
        // check if this is ignorable.
        int len = start+length;
        for( int i=start; i<len; i++ )
            if( !WhiteSpaceProcessor.isWhiteSpace(ch[i]) ) {
                super.characters(ch, start, length);
                return;
            }
        // if it's entirely whitespace, ignore it.
        break;
    }
}
 
Example 13
Source File: WhitespaceStripper.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Forwars the buffered characters if it contains any non-whitespace
 * character.
 */
private void processPendingText() throws SAXException {
    if(state==AFTER_START_ELEMENT) {
        for( int i=bufLen-1; i>=0; i-- )
            if( !WhiteSpaceProcessor.isWhiteSpace(buf[i]) ) {
                super.characters(buf, 0, bufLen);
                return;
           }
    }
}
 
Example 14
Source File: WhitespaceStripper.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Forwars the buffered characters if it contains any non-whitespace
 * character.
 */
private void processPendingText() throws SAXException {
    if(state==AFTER_START_ELEMENT) {
        for( int i=bufLen-1; i>=0; i-- )
            if( !WhiteSpaceProcessor.isWhiteSpace(buf[i]) ) {
                super.characters(buf, 0, bufLen);
                return;
           }
    }
}
 
Example 15
Source File: StAXStreamConnector.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private void processText( boolean ignorable ) throws SAXException {
    if( predictor.expectText() && (!ignorable || !WhiteSpaceProcessor.isWhiteSpace(buffer) || context.getCurrentState().isMixed())) {
        if(textReported) {
            textReported = false;
        } else {
            visitor.text(buffer);
        }
    }
    buffer.setLength(0);
}
 
Example 16
Source File: StAXStreamConnector.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private void processText( boolean ignorable ) throws SAXException {
    if( predictor.expectText() && (!ignorable || !WhiteSpaceProcessor.isWhiteSpace(buffer) || context.getCurrentState().isMixed())) {
        if(textReported) {
            textReported = false;
        } else {
            visitor.text(buffer);
        }
    }
    buffer.setLength(0);
}
 
Example 17
Source File: WhitespaceStripper.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public void characters(char[] ch, int start, int length) throws SAXException {
    switch(state) {
    case AFTER_START_ELEMENT:
        // we have to store the characters here, even if it consists entirely
        // of whitespaces. This is because successive characters event might
        // include non-whitespace char, in which case all the whitespaces in
        // this event may suddenly become significant.
        if( bufLen+length>buf.length ) {
            // reallocate buffer
            char[] newBuf = new char[Math.max(bufLen+length,buf.length*2)];
            System.arraycopy(buf,0,newBuf,0,bufLen);
            buf = newBuf;
        }
        System.arraycopy(ch,start,buf,bufLen,length);
        bufLen += length;
        break;
    case AFTER_END_ELEMENT:
        // check if this is ignorable.
        int len = start+length;
        for( int i=start; i<len; i++ )
            if( !WhiteSpaceProcessor.isWhiteSpace(ch[i]) ) {
                super.characters(ch, start, length);
                return;
            }
        // if it's entirely whitespace, ignore it.
        break;
    }
}
 
Example 18
Source File: FastInfosetConnector.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
private void processBufferedText(boolean ignorable) throws SAXException {
    if (!ignorable || !WhiteSpaceProcessor.isWhiteSpace(buffer)) {
        visitor.text(buffer);
        textReported = true;
    }
}
 
Example 19
Source File: SAXConnector.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
private void processText( boolean ignorable ) throws SAXException {
    if (predictor.expectText() && (!ignorable || !WhiteSpaceProcessor.isWhiteSpace(buffer)))
        next.text(buffer);
    buffer.setLength(0);
}
 
Example 20
Source File: FastInfosetConnector.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
private void processBufferedText(boolean ignorable) throws SAXException {
    if (!ignorable || !WhiteSpaceProcessor.isWhiteSpace(buffer)) {
        visitor.text(buffer);
        textReported = true;
    }
}