com.sun.xml.internal.bind.WhiteSpaceProcessor Java Examples

The following examples show how to use com.sun.xml.internal.bind.WhiteSpaceProcessor. 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 hottub 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-8 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 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 #4
Source File: RuntimeBuiltinLeafInfoImpl.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public Class parse(CharSequence text) throws SAXException {
    TODO.checkSpec("JSR222 Issue #42");
    try {
        String name = WhiteSpaceProcessor.trim(text).toString();
        ClassLoader cl = UnmarshallingContext.getInstance().classLoader;
        if(cl==null)
            cl = Thread.currentThread().getContextClassLoader();

        if(cl!=null)
            return cl.loadClass(name);
        else
            return Class.forName(name);
    } catch (ClassNotFoundException e) {
        UnmarshallingContext.getInstance().handleError(e);
        return null;
    }
}
 
Example #5
Source File: qname.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
public void text(String $value) throws SAXException {
    int $ai;
    switch($_ngcc_current_state) {
    case 0:
        {
            revertToParentFromText($runtime.parseUName(qvalue), super._cookie, $value);
        }
        break;
    case 1:
        {
            qvalue = WhiteSpaceProcessor.collapse($value);
            $_ngcc_current_state = 0;
        }
        break;
    }
}
 
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: RuntimeBuiltinLeafInfoImpl.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
public Class parse(CharSequence text) throws SAXException {
    TODO.checkSpec("JSR222 Issue #42");
    try {
        String name = WhiteSpaceProcessor.trim(text).toString();
        ClassLoader cl = UnmarshallingContext.getInstance().classLoader;
        if(cl==null)
            cl = Thread.currentThread().getContextClassLoader();

        if(cl!=null)
            return cl.loadClass(name);
        else
            return Class.forName(name);
    } catch (ClassNotFoundException e) {
        UnmarshallingContext.getInstance().handleError(e);
        return null;
    }
}
 
Example #8
Source File: qname.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public void text(String $value) throws SAXException {
    int $ai;
    switch($_ngcc_current_state) {
    case 0:
        {
            revertToParentFromText($runtime.parseUName(qvalue), super._cookie, $value);
        }
        break;
    case 1:
        {
            qvalue = WhiteSpaceProcessor.collapse($value);
            $_ngcc_current_state = 0;
        }
        break;
    }
}
 
Example #9
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 #10
Source File: ListTransducedAccessorImpl.java    From openjdk-jdk8u-backup 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 #11
Source File: RuntimeBuiltinLeafInfoImpl.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
public Class parse(CharSequence text) throws SAXException {
    TODO.checkSpec("JSR222 Issue #42");
    try {
        String name = WhiteSpaceProcessor.trim(text).toString();
        ClassLoader cl = UnmarshallingContext.getInstance().classLoader;
        if(cl==null)
            cl = Thread.currentThread().getContextClassLoader();

        if(cl!=null)
            return cl.loadClass(name);
        else
            return Class.forName(name);
    } catch (ClassNotFoundException e) {
        UnmarshallingContext.getInstance().handleError(e);
        return null;
    }
}
 
Example #12
Source File: FastInfosetConnector.java    From jdk8u60 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 #13
Source File: FastInfosetConnector.java    From openjdk-jdk8u-backup 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 #14
Source File: qname.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public void text(String $value) throws SAXException {
    int $ai;
    switch($_ngcc_current_state) {
    case 0:
        {
            revertToParentFromText($runtime.parseUName(qvalue), super._cookie, $value);
        }
        break;
    case 1:
        {
            qvalue = WhiteSpaceProcessor.collapse($value);
            $_ngcc_current_state = 0;
        }
        break;
    }
}
 
Example #15
Source File: RuntimeBuiltinLeafInfoImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public Class parse(CharSequence text) throws SAXException {
    TODO.checkSpec("JSR222 Issue #42");
    try {
        String name = WhiteSpaceProcessor.trim(text).toString();
        ClassLoader cl = UnmarshallingContext.getInstance().classLoader;
        if(cl==null)
            cl = Thread.currentThread().getContextClassLoader();

        if(cl!=null)
            return cl.loadClass(name);
        else
            return Class.forName(name);
    } catch (ClassNotFoundException e) {
        UnmarshallingContext.getInstance().handleError(e);
        return null;
    }
}
 
Example #16
Source File: FastInfosetConnector.java    From openjdk-8-source 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 #17
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 #18
Source File: RuntimeBuiltinLeafInfoImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public Class parse(CharSequence text) throws SAXException {
    TODO.checkSpec("JSR222 Issue #42");
    try {
        String name = WhiteSpaceProcessor.trim(text).toString();
        ClassLoader cl = UnmarshallingContext.getInstance().classLoader;
        if(cl==null)
            cl = Thread.currentThread().getContextClassLoader();

        if(cl!=null)
            return cl.loadClass(name);
        else
            return Class.forName(name);
    } catch (ClassNotFoundException e) {
        UnmarshallingContext.getInstance().handleError(e);
        return null;
    }
}
 
Example #19
Source File: RuntimeBuiltinLeafInfoImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public UUID parse(CharSequence text) throws SAXException {
    TODO.checkSpec("JSR222 Issue #42");
    try {
        return UUID.fromString(WhiteSpaceProcessor.trim(text).toString());
    } catch (IllegalArgumentException e) {
        UnmarshallingContext.getInstance().handleError(e);
        return null;
    }
}
 
Example #20
Source File: RuntimeBuiltinLeafInfoImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public UUID parse(CharSequence text) throws SAXException {
    TODO.checkSpec("JSR222 Issue #42");
    try {
        return UUID.fromString(WhiteSpaceProcessor.trim(text).toString());
    } catch (IllegalArgumentException e) {
        UnmarshallingContext.getInstance().handleError(e);
        return null;
    }
}
 
Example #21
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 #22
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 #23
Source File: WhitespaceStripper.java    From openjdk-jdk8u 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 #24
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 #25
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 #26
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 #27
Source File: WhitespaceStripper.java    From hottub 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 #28
Source File: StAXStreamConnector.java    From hottub 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 #29
Source File: WhitespaceStripper.java    From hottub 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 #30
Source File: RuntimeBuiltinLeafInfoImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public UUID parse(CharSequence text) throws SAXException {
    TODO.checkSpec("JSR222 Issue #42");
    try {
        return UUID.fromString(WhiteSpaceProcessor.trim(text).toString());
    } catch (IllegalArgumentException e) {
        UnmarshallingContext.getInstance().handleError(e);
        return null;
    }
}