Java Code Examples for com.fasterxml.jackson.core.io.CharTypes#getInputCodeComment()

The following examples show how to use com.fasterxml.jackson.core.io.CharTypes#getInputCodeComment() . 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: UTF8StreamJsonParser.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Method for skipping contents of an input line; usually for CPP
 * and YAML style comments.
 */
private final void _skipLine() throws IOException
{
    // Ok: need to find EOF or linefeed
    final int[] codes = CharTypes.getInputCodeComment();
    while ((_inputPtr < _inputEnd) || _loadMore()) {
        int i = (int) _inputBuffer[_inputPtr++] & 0xFF;
        int code = codes[i];
        if (code != 0) {
            switch (code) {
            case INT_LF:
                ++_currInputRow;
                _currInputRowStart = _inputPtr;
                return;
            case INT_CR:
                _skipCR();
                return;
            case '*': // nop for these comments
                break;
            case 2: // 2-byte UTF
                _skipUtf8_2();
                break;
            case 3: // 3-byte UTF
                _skipUtf8_3();
                break;
            case 4: // 4-byte UTF
                _skipUtf8_4(i);
                break;
            default: // e.g. -1
                if (code < 0) {
                    // Is this good enough error message?
                    _reportInvalidChar(i);
                }
            }
        }
    }
}
 
Example 2
Source File: UTF8DataInputJsonParser.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
private final void _skipCComment() throws IOException
{
    // Need to be UTF-8 aware here to decode content (for skipping)
    final int[] codes = CharTypes.getInputCodeComment();
    int i = _inputData.readUnsignedByte();

    // Ok: need the matching '*/'
    main_loop:
    while (true) {
        int code = codes[i];
        if (code != 0) {
            switch (code) {
            case '*':
                i = _inputData.readUnsignedByte();
                if (i == INT_SLASH) {
                    return;
                }
                continue main_loop;
            case INT_LF:
            case INT_CR:
                ++_currInputRow;
                break;
            case 2: // 2-byte UTF
                _skipUtf8_2();
                break;
            case 3: // 3-byte UTF
                _skipUtf8_3();
                break;
            case 4: // 4-byte UTF
                _skipUtf8_4();
                break;
            default: // e.g. -1
                // Is this good enough error message?
                _reportInvalidChar(i);
            }
        }
        i = _inputData.readUnsignedByte();
    }
}
 
Example 3
Source File: UTF8DataInputJsonParser.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Method for skipping contents of an input line; usually for CPP
 * and YAML style comments.
 */
private final void _skipLine() throws IOException
{
    // Ok: need to find EOF or linefeed
    final int[] codes = CharTypes.getInputCodeComment();
    while (true) {
        int i = _inputData.readUnsignedByte();
        int code = codes[i];
        if (code != 0) {
            switch (code) {
            case INT_LF:
            case INT_CR:
                ++_currInputRow;
                return;
            case '*': // nop for these comments
                break;
            case 2: // 2-byte UTF
                _skipUtf8_2();
                break;
            case 3: // 3-byte UTF
                _skipUtf8_3();
                break;
            case 4: // 4-byte UTF
                _skipUtf8_4();
                break;
            default: // e.g. -1
                if (code < 0) {
                    // Is this good enough error message?
                    _reportInvalidChar(i);
                }
            }
        }
    }
}
 
Example 4
Source File: UTF8StreamJsonParser.java    From openbd-core with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Method for skipping contents of an input line; usually for CPP
 * and YAML style comments.
 */
private final void _skipLine() throws IOException
{
    // Ok: need to find EOF or linefeed
    final int[] codes = CharTypes.getInputCodeComment();
    while ((_inputPtr < _inputEnd) || loadMore()) {
        int i = (int) _inputBuffer[_inputPtr++] & 0xFF;
        int code = codes[i];
        if (code != 0) {
            switch (code) {
            case INT_LF:
                ++_currInputRow;
                _currInputRowStart = _inputPtr;
                return;
            case INT_CR:
                _skipCR();
                return;
            case '*': // nop for these comments
                break;
            case 2: // 2-byte UTF
                _skipUtf8_2(i);
                break;
            case 3: // 3-byte UTF
                _skipUtf8_3(i);
                break;
            case 4: // 4-byte UTF
                _skipUtf8_4(i);
                break;
            default: // e.g. -1
                if (code < 0) {
                    // Is this good enough error message?
                    _reportInvalidChar(i);
                }
            }
        }
    }
}
 
Example 5
Source File: UTF8StreamJsonParser.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
private final void _skipCComment() throws IOException
{
    // Need to be UTF-8 aware here to decode content (for skipping)
    final int[] codes = CharTypes.getInputCodeComment();

    // Ok: need the matching '*/'
    main_loop:
    while ((_inputPtr < _inputEnd) || _loadMore()) {
        int i = (int) _inputBuffer[_inputPtr++] & 0xFF;
        int code = codes[i];
        if (code != 0) {
            switch (code) {
            case '*':
                if (_inputPtr >= _inputEnd && !_loadMore()) {
                    break main_loop;
                }
                if (_inputBuffer[_inputPtr] == INT_SLASH) {
                    ++_inputPtr;
                    return;
                }
                break;
            case INT_LF:
                ++_currInputRow;
                _currInputRowStart = _inputPtr;
                break;
            case INT_CR:
                _skipCR();
                break;
            case 2: // 2-byte UTF
                _skipUtf8_2();
                break;
            case 3: // 3-byte UTF
                _skipUtf8_3();
                break;
            case 4: // 4-byte UTF
                _skipUtf8_4(i);
                break;
            default: // e.g. -1
                // Is this good enough error message?
                _reportInvalidChar(i);
            }
        }
    }
    _reportInvalidEOF(" in a comment", null);
}
 
Example 6
Source File: UTF8StreamJsonParser.java    From openbd-core with GNU General Public License v3.0 4 votes vote down vote up
private final void _skipCComment() throws IOException
{
    // Need to be UTF-8 aware here to decode content (for skipping)
    final int[] codes = CharTypes.getInputCodeComment();

    // Ok: need the matching '*/'
    main_loop:
    while ((_inputPtr < _inputEnd) || loadMore()) {
        int i = (int) _inputBuffer[_inputPtr++] & 0xFF;
        int code = codes[i];
        if (code != 0) {
            switch (code) {
            case '*':
                if (_inputPtr >= _inputEnd && !loadMore()) {
                    break main_loop;
                }
                if (_inputBuffer[_inputPtr] == INT_SLASH) {
                    ++_inputPtr;
                    return;
                }
                break;
            case INT_LF:
                ++_currInputRow;
                _currInputRowStart = _inputPtr;
                break;
            case INT_CR:
                _skipCR();
                break;
            case 2: // 2-byte UTF
                _skipUtf8_2(i);
                break;
            case 3: // 3-byte UTF
                _skipUtf8_3(i);
                break;
            case 4: // 4-byte UTF
                _skipUtf8_4(i);
                break;
            default: // e.g. -1
                // Is this good enough error message?
                _reportInvalidChar(i);
            }
        }
    }
    _reportInvalidEOF(" in a comment");
}