当前位置: 首页>>代码示例>>Java>>正文


Java CharTypes.getInputCodeUtf8JsNames方法代码示例

本文整理汇总了Java中com.fasterxml.jackson.core.io.CharTypes.getInputCodeUtf8JsNames方法的典型用法代码示例。如果您正苦于以下问题:Java CharTypes.getInputCodeUtf8JsNames方法的具体用法?Java CharTypes.getInputCodeUtf8JsNames怎么用?Java CharTypes.getInputCodeUtf8JsNames使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.fasterxml.jackson.core.io.CharTypes的用法示例。


在下文中一共展示了CharTypes.getInputCodeUtf8JsNames方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: _handleOddName

import com.fasterxml.jackson.core.io.CharTypes; //导入方法依赖的package包/类
/**
     * Method called when we see non-white space character other
     * than double quote, when expecting a field name.
     * In standard mode will just throw an exception; but
     * in non-standard modes may be able to parse name.
     */
    private JsonToken _handleOddName(int ch) throws IOException
    {
        // First: may allow single quotes
        switch (ch) {
        case '#':
            // Careful, since this may alternatively be leading char of
            // unquoted name...
            if (JsonParser.Feature.ALLOW_YAML_COMMENTS.enabledIn(_features)) {
                return _finishHashComment(MINOR_FIELD_LEADING_WS);
            }
            break;
        case '/':
            return _startSlashComment(MINOR_FIELD_LEADING_WS);
        case '\'':
            if (isEnabled(Feature.ALLOW_SINGLE_QUOTES)) {
                return _finishAposName(0, 0, 0);
            }
            break;
        case ']': // for better error reporting...
            return _closeArrayScope();
        }
        // allow unquoted names if feature enabled:
        if (!isEnabled(Feature.ALLOW_UNQUOTED_FIELD_NAMES)) {
         // !!! TODO: Decode UTF-8 characters properly...
//            char c = (char) _decodeCharForError(ch);
            char c = (char) ch;
            _reportUnexpectedChar(c, "was expecting double-quote to start field name");
        }
        // Also: note that although we use a different table here, it does NOT handle UTF-8
        // decoding. It'll just pass those high-bit codes as acceptable for later decoding.
        final int[] codes = CharTypes.getInputCodeUtf8JsNames();
        // Also: must start with a valid character...
        if (codes[ch] != 0) {
            _reportUnexpectedChar(ch, "was expecting either valid name character (for unquoted name) or double-quote (for quoted) to start field name");
        }

        return _finishUnquotedName(0, ch, 1);
    }
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:45,代码来源:NonBlockingJsonParser.java

示例2: _handleOddName

import com.fasterxml.jackson.core.io.CharTypes; //导入方法依赖的package包/类
/**
 * Method called when we see non-white space character other
 * than double quote, when expecting a field name.
 * In standard mode will just throw an exception; but
 * in non-standard modes may be able to parse name.
 */
protected String _handleOddName(int ch) throws IOException
{
    // First: may allow single quotes
    if (ch == INT_APOS && isEnabled(Feature.ALLOW_SINGLE_QUOTES)) {
        return _parseAposName();
    }
    // Allow unquoted names if feature enabled:
    if (!isEnabled(Feature.ALLOW_UNQUOTED_FIELD_NAMES)) {
        char c = (char) _decodeCharForError(ch);
        _reportUnexpectedChar(c, "was expecting double-quote to start field name");
    }
    /* Also: note that although we use a different table here,
     * it does NOT handle UTF-8 decoding. It'll just pass those
     * high-bit codes as acceptable for later decoding.
     */
    final int[] codes = CharTypes.getInputCodeUtf8JsNames();
    // Also: must start with a valid character...
    if (codes[ch] != 0) {
        _reportUnexpectedChar(ch, "was expecting either valid name character (for unquoted name) or double-quote (for quoted) to start field name");
    }

    // Ok, now; instead of ultra-optimizing parsing here (as with regular
    // JSON names), let's just use the generic "slow" variant.
    // Can measure its impact later on if need be.
    int[] quads = _quadBuffer;
    int qlen = 0;
    int currQuad = 0;
    int currQuadBytes = 0;

    while (true) {
        // Ok, we have one more byte to add at any rate:
        if (currQuadBytes < 4) {
            ++currQuadBytes;
            currQuad = (currQuad << 8) | ch;
        } else {
            if (qlen >= quads.length) {
                _quadBuffer = quads = growArrayBy(quads, quads.length);
            }
            quads[qlen++] = currQuad;
            currQuad = ch;
            currQuadBytes = 1;
        }
        if (_inputPtr >= _inputEnd) {
            if (!_loadMore()) {
                _reportInvalidEOF(" in field name", JsonToken.FIELD_NAME);
            }
        }
        ch = _inputBuffer[_inputPtr] & 0xFF;
        if (codes[ch] != 0) {
            break;
        }
        ++_inputPtr;
    }

    if (currQuadBytes > 0) {
        if (qlen >= quads.length) {
            _quadBuffer = quads = growArrayBy(quads, quads.length);
        }
        quads[qlen++] = currQuad;
    }
    String name = _symbols.findName(quads, qlen);
    if (name == null) {
        name = addName(quads, qlen, currQuadBytes);
    }
    return name;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:73,代码来源:UTF8StreamJsonParser.java

示例3: _handleOddName

import com.fasterxml.jackson.core.io.CharTypes; //导入方法依赖的package包/类
/**
 * Method called when we see non-white space character other
 * than double quote, when expecting a field name.
 * In standard mode will just throw an exception; but
 * in non-standard modes may be able to parse name.
 */
protected String _handleOddName(int ch) throws IOException
{
    if (ch == '\'' && isEnabled(Feature.ALLOW_SINGLE_QUOTES)) {
        return _parseAposName();
    }
    if (!isEnabled(Feature.ALLOW_UNQUOTED_FIELD_NAMES)) {
        char c = (char) _decodeCharForError(ch);
        _reportUnexpectedChar(c, "was expecting double-quote to start field name");
    }
    /* Also: note that although we use a different table here,
     * it does NOT handle UTF-8 decoding. It'll just pass those
     * high-bit codes as acceptable for later decoding.
     */
    final int[] codes = CharTypes.getInputCodeUtf8JsNames();
    // Also: must start with a valid character...
    if (codes[ch] != 0) {
        _reportUnexpectedChar(ch, "was expecting either valid name character (for unquoted name) or double-quote (for quoted) to start field name");
    }

    /* Ok, now; instead of ultra-optimizing parsing here (as with
     * regular JSON names), let's just use the generic "slow"
     * variant. Can measure its impact later on if need be
     */
    int[] quads = _quadBuffer;
    int qlen = 0;
    int currQuad = 0;
    int currQuadBytes = 0;

    while (true) {
        // Ok, we have one more byte to add at any rate:
        if (currQuadBytes < 4) {
            ++currQuadBytes;
            currQuad = (currQuad << 8) | ch;
        } else {
            if (qlen >= quads.length) {
                _quadBuffer = quads = _growArrayBy(quads, quads.length);
            }
            quads[qlen++] = currQuad;
            currQuad = ch;
            currQuadBytes = 1;
        }
        ch = _inputData.readUnsignedByte();
        if (codes[ch] != 0) {
            break;
        }
    }
    // Note: we must "push back" character read here for future consumption
    _nextByte = ch;
    if (currQuadBytes > 0) {
        if (qlen >= quads.length) {
            _quadBuffer = quads = _growArrayBy(quads, quads.length);
        }
        quads[qlen++] = currQuad;
    }
    String name = _symbols.findName(quads, qlen);
    if (name == null) {
        name = addName(quads, qlen, currQuadBytes);
    }
    return name;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:67,代码来源:UTF8DataInputJsonParser.java

示例4: _finishUnquotedName

import com.fasterxml.jackson.core.io.CharTypes; //导入方法依赖的package包/类
/**
 * Parsing of optionally supported non-standard "unquoted" names: names without
 * either double-quotes or apostrophes surrounding them.
 * Unlike other 
 */
private JsonToken _finishUnquotedName(int qlen, int currQuad, int currQuadBytes)
    throws IOException
{
    int[] quads = _quadBuffer;
    final int[] codes = CharTypes.getInputCodeUtf8JsNames();

    // Ok, now; instead of ultra-optimizing parsing here (as with regular JSON names),
    // let's just use the generic "slow" variant. Can measure its impact later on if need be.
    while (true) {
        if (_inputPtr >= _inputEnd) {
            _quadLength = qlen;
            _pending32 = currQuad;
            _pendingBytes = currQuadBytes;
            _minorState = MINOR_FIELD_UNQUOTED_NAME;
            return (_currToken = JsonToken.NOT_AVAILABLE);
        }
        int ch = _inputBuffer[_inputPtr] & 0xFF;
        if (codes[ch] != 0) {
            break;
        }
        ++_inputPtr;
        // Ok, we have one more byte to add at any rate:
        if (currQuadBytes < 4) {
            ++currQuadBytes;
            currQuad = (currQuad << 8) | ch;
        } else {
            if (qlen >= quads.length) {
                _quadBuffer = quads = growArrayBy(quads, quads.length);
            }
            quads[qlen++] = currQuad;
            currQuad = ch;
            currQuadBytes = 1;
        }
    }

    if (currQuadBytes > 0) {
        if (qlen >= quads.length) {
            _quadBuffer = quads = growArrayBy(quads, quads.length);
        }
        quads[qlen++] = currQuad;
    }
    String name = _symbols.findName(quads, qlen);
    if (name == null) {
        name = _addName(quads, qlen, currQuadBytes);
    }
    return _fieldComplete(name);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:53,代码来源:NonBlockingJsonParser.java

示例5: _handleUnusualFieldName

import com.fasterxml.jackson.core.io.CharTypes; //导入方法依赖的package包/类
protected final Name _handleUnusualFieldName(int paramInt)
{
  if ((paramInt == 39) && (isEnabled(JsonParser.Feature.ALLOW_SINGLE_QUOTES)))
    return _parseApostropheFieldName();
  if (!isEnabled(JsonParser.Feature.ALLOW_UNQUOTED_FIELD_NAMES))
    _reportUnexpectedChar(paramInt, "was expecting double-quote to start field name");
  int[] arrayOfInt1 = CharTypes.getInputCodeUtf8JsNames();
  if (arrayOfInt1[paramInt] != 0)
    _reportUnexpectedChar(paramInt, "was expecting either valid name character (for unquoted name) or double-quote (for quoted) to start field name");
  Object localObject = this._quadBuffer;
  int i = 0;
  int j = 0;
  int k = 0;
  while (true)
  {
    if (k < 4)
    {
      k++;
      j = paramInt | j << 8;
    }
    else
    {
      if (i >= localObject.length)
      {
        int[] arrayOfInt3 = growArrayBy((int[])localObject, localObject.length);
        localObject = arrayOfInt3;
        this._quadBuffer = arrayOfInt3;
      }
      int m = i;
      i++;
      localObject[m] = j;
      j = paramInt;
      k = 1;
    }
    if ((this._inputPtr >= this._inputEnd) && (!loadMore()))
      _reportInvalidEOF(" in field name");
    paramInt = 0xFF & this._inputBuffer[this._inputPtr];
    if (arrayOfInt1[paramInt] != 0)
      break;
    this._inputPtr = (1 + this._inputPtr);
  }
  if (k > 0)
  {
    if (i >= localObject.length)
    {
      int[] arrayOfInt2 = growArrayBy((int[])localObject, localObject.length);
      localObject = arrayOfInt2;
      this._quadBuffer = arrayOfInt2;
    }
    int n = i;
    i++;
    localObject[n] = j;
  }
  Name localName1 = this._symbols.findName((int[])localObject, i);
  Name localName2 = localName1;
  if (localName1 == null)
    localName2 = addName((int[])localObject, i, k);
  return localName2;
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:60,代码来源:UTF8StreamJsonParser.java

示例6: _handleOddName

import com.fasterxml.jackson.core.io.CharTypes; //导入方法依赖的package包/类
/**
 * Method called when we see non-white space character other
 * than double quote, when expecting a field name.
 * In standard mode will just throw an expection; but
 * in non-standard modes may be able to parse name.
 */
protected Name _handleOddName(int ch) throws IOException
{
    // [JACKSON-173]: allow single quotes
    if (ch == '\'' && isEnabled(Feature.ALLOW_SINGLE_QUOTES)) {
        return _parseAposName();
    }
    // [JACKSON-69]: allow unquoted names if feature enabled:
    if (!isEnabled(Feature.ALLOW_UNQUOTED_FIELD_NAMES)) {
        _reportUnexpectedChar(ch, "was expecting double-quote to start field name");
    }
    /* Also: note that although we use a different table here,
     * it does NOT handle UTF-8 decoding. It'll just pass those
     * high-bit codes as acceptable for later decoding.
     */
    final int[] codes = CharTypes.getInputCodeUtf8JsNames();
    // Also: must start with a valid character...
    if (codes[ch] != 0) {
        _reportUnexpectedChar(ch, "was expecting either valid name character (for unquoted name) or double-quote (for quoted) to start field name");
    }

    /* Ok, now; instead of ultra-optimizing parsing here (as with
     * regular JSON names), let's just use the generic "slow"
     * variant. Can measure its impact later on if need be
     */
    int[] quads = _quadBuffer;
    int qlen = 0;
    int currQuad = 0;
    int currQuadBytes = 0;

    while (true) {
        // Ok, we have one more byte to add at any rate:
        if (currQuadBytes < 4) {
            ++currQuadBytes;
            currQuad = (currQuad << 8) | ch;
        } else {
            if (qlen >= quads.length) {
                _quadBuffer = quads = growArrayBy(quads, quads.length);
            }
            quads[qlen++] = currQuad;
            currQuad = ch;
            currQuadBytes = 1;
        }
        if (_inputPtr >= _inputEnd) {
            if (!loadMore()) {
                _reportInvalidEOF(" in field name");
            }
        }
        ch = _inputBuffer[_inputPtr] & 0xFF;
        if (codes[ch] != 0) {
            break;
        }
        ++_inputPtr;
    }

    if (currQuadBytes > 0) {
        if (qlen >= quads.length) {
            _quadBuffer = quads = growArrayBy(quads, quads.length);
        }
        quads[qlen++] = currQuad;
    }
    Name name = _symbols.findName(quads, qlen);
    if (name == null) {
        name = addName(quads, qlen, currQuadBytes);
    }
    return name;
}
 
开发者ID:BFergerson,项目名称:Beam,代码行数:73,代码来源:UTF8StreamJsonParser.java

示例7: _handleUnusualFieldName

import com.fasterxml.jackson.core.io.CharTypes; //导入方法依赖的package包/类
/**
 * Method called when we see non-white space character other
 * than double quote, when expecting a field name.
 * In standard mode will just throw an expection; but
 * in non-standard modes may be able to parse name.
 */
protected Name _handleUnusualFieldName(int ch)
    throws IOException, JsonParseException
{
    // [JACKSON-173]: allow single quotes
    if (ch == INT_APOSTROPHE && isEnabled(Feature.ALLOW_SINGLE_QUOTES)) {
        return _parseApostropheFieldName();
    }
    // [JACKSON-69]: allow unquoted names if feature enabled:
    if (!isEnabled(Feature.ALLOW_UNQUOTED_FIELD_NAMES)) {
        _reportUnexpectedChar(ch, "was expecting double-quote to start field name");
    }
    /* Also: note that although we use a different table here,
     * it does NOT handle UTF-8 decoding. It'll just pass those
     * high-bit codes as acceptable for later decoding.
     */
    final int[] codes = CharTypes.getInputCodeUtf8JsNames();
    // Also: must start with a valid character...
    if (codes[ch] != 0) {
        _reportUnexpectedChar(ch, "was expecting either valid name character (for unquoted name) or double-quote (for quoted) to start field name");
    }

    /* Ok, now; instead of ultra-optimizing parsing here (as with
     * regular JSON names), let's just use the generic "slow"
     * variant. Can measure its impact later on if need be
     */
    int[] quads = _quadBuffer;
    int qlen = 0;
    int currQuad = 0;
    int currQuadBytes = 0;

    while (true) {
        // Ok, we have one more byte to add at any rate:
        if (currQuadBytes < 4) {
            ++currQuadBytes;
            currQuad = (currQuad << 8) | ch;
        } else {
            if (qlen >= quads.length) {
                _quadBuffer = quads = growArrayBy(quads, quads.length);
            }
            quads[qlen++] = currQuad;
            currQuad = ch;
            currQuadBytes = 1;
        }
        if (_inputPtr >= _inputEnd) {
            if (!loadMore()) {
                _reportInvalidEOF(" in field name");
            }
        }
        ch = _inputBuffer[_inputPtr] & 0xFF;
        if (codes[ch] != 0) {
            break;
        }
        ++_inputPtr;
    }

    if (currQuadBytes > 0) {
        if (qlen >= quads.length) {
            _quadBuffer = quads = growArrayBy(quads, quads.length);
        }
        quads[qlen++] = currQuad;
    }
    Name name = _symbols.findName(quads, qlen);
    if (name == null) {
        name = addName(quads, qlen, currQuadBytes);
    }
    return name;
}
 
开发者ID:kbase,项目名称:cmonkey,代码行数:74,代码来源:KBaseJsonParser.java


注:本文中的com.fasterxml.jackson.core.io.CharTypes.getInputCodeUtf8JsNames方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。