• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java CharTypes类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



CharTypes类属于com.fasterxml.jackson.core.io包,在下文中一共展示了CharTypes类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: toString

import com.fasterxml.jackson.core.io.CharTypes; //导入依赖的package包/类
/**
 * Overridden to provide developer readable "JsonPath" representation
 * of the context.
 */
@Override
public String toString() {
    StringBuilder sb = new StringBuilder(64);
    switch (_type) {
    case TYPE_ROOT:
        sb.append("/");
        break;
    case TYPE_ARRAY:
        sb.append('[');
        sb.append(getCurrentIndex());
        sb.append(']');
        break;
    case TYPE_OBJECT:
    default:
        sb.append('{');
        String currentName = currentName();
        if (currentName != null) {
            sb.append('"');
            CharTypes.appendQuoted(sb, currentName);
            sb.append('"');
        } else {
            sb.append('?');
        }
        sb.append('}');
        break;
    }
    return sb.toString();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:33,代码来源:TokenStreamContext.java


示例2: _skipLine

import com.fasterxml.jackson.core.io.CharTypes; //导入依赖的package包/类
/**
 * 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);
                }
            }
        }
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:41,代码来源:UTF8StreamJsonParser.java


示例3: _skipCComment

import com.fasterxml.jackson.core.io.CharTypes; //导入依赖的package包/类
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();
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:40,代码来源:UTF8DataInputJsonParser.java


示例4: _skipLine

import com.fasterxml.jackson.core.io.CharTypes; //导入依赖的package包/类
/**
 * 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);
                }
            }
        }
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:38,代码来源:UTF8DataInputJsonParser.java


示例5: _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


示例6: testQuoting

import com.fasterxml.jackson.core.io.CharTypes; //导入依赖的package包/类
public void testQuoting()
{
    StringBuilder sb = new StringBuilder();
    CharTypes.appendQuoted(sb, "\n");
    assertEquals("\\n", sb.toString());
    sb = new StringBuilder();
    CharTypes.appendQuoted(sb, "\u0000");
    assertEquals("\\u0000", sb.toString());
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:10,代码来源:TestCharTypes.java


示例7: _skipCppComment

import com.fasterxml.jackson.core.io.CharTypes; //导入依赖的package包/类
private void _skipCppComment()
{
  int[] arrayOfInt = CharTypes.getInputCodeComment();
  while ((this._inputPtr < this._inputEnd) || (loadMore()))
  {
    byte[] arrayOfByte = this._inputBuffer;
    int i = this._inputPtr;
    this._inputPtr = (i + 1);
    int j = 0xFF & arrayOfByte[i];
    int k = arrayOfInt[j];
    if (k != 0)
      switch (k)
      {
      default:
        break;
      case 10:
        _skipLF();
        return;
      case 13:
        _skipCR();
        return;
      case 42:
        break;
      case 2:
        _skipUtf8_2(j);
        break;
      case 3:
        _skipUtf8_3(j);
        break;
      case 4:
        _skipUtf8_4(j);
        continue;
        _reportInvalidChar(j);
      }
  }
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:37,代码来源:UTF8StreamJsonParser.java


示例8: toString

import com.fasterxml.jackson.core.io.CharTypes; //导入依赖的package包/类
public final String toString()
{
  StringBuilder localStringBuilder = new StringBuilder(64);
  switch (this._type)
  {
  default:
    break;
  case 0:
    localStringBuilder.append("/");
    break;
  case 1:
    localStringBuilder.append('[');
    localStringBuilder.append(getCurrentIndex());
    localStringBuilder.append(']');
    break;
  case 2:
    localStringBuilder.append('{');
    if (this._currentName != null)
    {
      localStringBuilder.append('"');
      CharTypes.appendQuoted(localStringBuilder, this._currentName);
      localStringBuilder.append('"');
    }
    else
    {
      localStringBuilder.append('?');
    }
    localStringBuilder.append('}');
  }
  return localStringBuilder.toString();
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:32,代码来源:JsonReadContext.java


示例9: _finishString

import com.fasterxml.jackson.core.io.CharTypes; //导入依赖的package包/类
protected final void _finishString()
{
  int i = this._inputPtr;
  int j = this._inputEnd;
  if (i < j)
  {
    int[] arrayOfInt = CharTypes.getInputCodeLatin1();
    int m = arrayOfInt.length;
    do
    {
      int n = this._inputBuffer[i];
      if ((n < m) && (arrayOfInt[n] != 0))
      {
        if (n != 34)
          break;
        TextBuffer localTextBuffer2 = this._textBuffer;
        char[] arrayOfChar2 = this._inputBuffer;
        int i1 = this._inputPtr;
        localTextBuffer2.resetWithShared(arrayOfChar2, i1, i - i1);
        this._inputPtr = (i + 1);
        return;
      }
      i++;
    }
    while (i < j);
  }
  TextBuffer localTextBuffer1 = this._textBuffer;
  char[] arrayOfChar1 = this._inputBuffer;
  int k = this._inputPtr;
  localTextBuffer1.resetWithCopy(arrayOfChar1, k, i - k);
  this._inputPtr = i;
  _finishString2();
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:34,代码来源:ReaderBasedJsonParser.java


示例10: _parseApostropheFieldName

import com.fasterxml.jackson.core.io.CharTypes; //导入依赖的package包/类
protected final String _parseApostropheFieldName()
{
  int i = this._inputPtr;
  int j = this._hashSeed;
  int k = this._inputEnd;
  if (i < k)
  {
    int[] arrayOfInt = CharTypes.getInputCodeLatin1();
    int n = arrayOfInt.length;
    do
    {
      int i1 = this._inputBuffer[i];
      if (i1 == 39)
      {
        int i2 = this._inputPtr;
        this._inputPtr = (i + 1);
        return this._symbols.findSymbol(this._inputBuffer, i2, i - i2, j);
      }
      if ((i1 < n) && (arrayOfInt[i1] != 0))
        break;
      j = i1 + j * 33;
      i++;
    }
    while (i < k);
  }
  int m = this._inputPtr;
  this._inputPtr = i;
  return _parseFieldName2(m, j, 39);
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:30,代码来源:ReaderBasedJsonParser.java


示例11: _parseFieldName

import com.fasterxml.jackson.core.io.CharTypes; //导入依赖的package包/类
protected final String _parseFieldName(int paramInt)
{
  if (paramInt != 34)
    return _handleUnusualFieldName(paramInt);
  int i = this._inputPtr;
  int j = this._hashSeed;
  int k = this._inputEnd;
  if (i < k)
  {
    int[] arrayOfInt = CharTypes.getInputCodeLatin1();
    int n = arrayOfInt.length;
    do
    {
      int i1 = this._inputBuffer[i];
      if ((i1 < n) && (arrayOfInt[i1] != 0))
      {
        if (i1 != 34)
          break;
        int i2 = this._inputPtr;
        this._inputPtr = (i + 1);
        return this._symbols.findSymbol(this._inputBuffer, i2, i - i2, j);
      }
      j = i1 + j * 33;
      i++;
    }
    while (i < k);
  }
  int m = this._inputPtr;
  this._inputPtr = i;
  return _parseFieldName2(m, j, 34);
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:32,代码来源:ReaderBasedJsonParser.java


示例12: _skipLine

import com.fasterxml.jackson.core.io.CharTypes; //导入依赖的package包/类
/**
 * 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);
                }
            }
        }
    }
}
 
开发者ID:BFergerson,项目名称:Beam,代码行数:41,代码来源:UTF8StreamJsonParser.java


示例13: toString

import com.fasterxml.jackson.core.io.CharTypes; //导入依赖的package包/类
/**
 * Overridden to provide developer readable "JsonPath" representation
 * of the context.
 */
@Override
public String toString()
{
    StringBuilder sb = new StringBuilder(64);
    switch (_type) {
    case TYPE_ROOT:
        sb.append("/");
        break;
    case TYPE_ARRAY:
        sb.append('[');
        sb.append(getCurrentIndex());
        sb.append(']');
        break;
    case TYPE_OBJECT:
        sb.append('{');
        if (_currentName != null) {
            sb.append('"');
            CharTypes.appendQuoted(sb, _currentName);
            sb.append('"');
        } else {
            sb.append('?');
        }
        sb.append('}');
        break;
    }
    return sb.toString();
}
 
开发者ID:BFergerson,项目名称:Beam,代码行数:32,代码来源:JsonReadContext.java


示例14: _skipCppComment

import com.fasterxml.jackson.core.io.CharTypes; //导入依赖的package包/类
private void _skipCppComment()
    throws IOException, JsonParseException
{
    // 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:
                _skipLF();
                return;
            case INT_CR:
                _skipCR();
                return;
            case INT_ASTERISK: // 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
                // Is this good enough error message?
                _reportInvalidChar(i);
            }
        }
    }
}
 
开发者ID:kbase,项目名称:cmonkey,代码行数:35,代码来源:KBaseJsonParser.java


示例15: _finishString

import com.fasterxml.jackson.core.io.CharTypes; //导入依赖的package包/类
@Override
protected void _finishString()
    throws IOException, JsonParseException
{
    /* First: let's try to see if we have simple String value: one
     * that does not cross input buffer boundary, and does not
     * contain escape sequences.
     */
    int ptr = _inputPtr;
    final int inputLen = _inputEnd;

    if (ptr < inputLen) {
        final int[] codes = CharTypes.getInputCodeLatin1();
        final int maxCode = codes.length;

        do {
            int ch = _inputBuffer[ptr];
            if (ch < maxCode && codes[ch] != 0) {
                if (ch == '"') {
                    _textBuffer.resetWithShared(_inputBuffer, _inputPtr, (ptr-_inputPtr));
                    _inputPtr = ptr+1;
                    // Yes, we got it all
                    return;
                }
                break;
            }
            ++ptr;
        } while (ptr < inputLen);
    }

    /* Either ran out of input, or bumped into an escape
     * sequence...
     */
    _textBuffer.resetWithCopy(_inputBuffer, _inputPtr, (ptr-_inputPtr));
    _inputPtr = ptr;
    _finishString2();
}
 
开发者ID:joyplus,项目名称:joyplus-tv,代码行数:38,代码来源:ReaderBasedJsonParser.java


示例16: _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


示例17: _skipCComment

import com.fasterxml.jackson.core.io.CharTypes; //导入依赖的package包/类
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);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:46,代码来源:UTF8StreamJsonParser.java


示例18: _decodeEscaped

import com.fasterxml.jackson.core.io.CharTypes; //导入依赖的package包/类
@Override
protected char _decodeEscaped() throws IOException
{
    if (_inputPtr >= _inputEnd) {
        if (!_loadMore()) {
            _reportInvalidEOF(" in character escape sequence", JsonToken.VALUE_STRING);
        }
    }
    int c = (int) _inputBuffer[_inputPtr++];

    switch (c) {
        // First, ones that are mapped
    case 'b':
        return '\b';
    case 't':
        return '\t';
    case 'n':
        return '\n';
    case 'f':
        return '\f';
    case 'r':
        return '\r';

        // And these are to be returned as they are
    case '"':
    case '/':
    case '\\':
        return (char) c;

    case 'u': // and finally hex-escaped
        break;

    default:
        return _handleUnrecognizedCharacterEscape((char) _decodeCharForError(c));
    }

    // Ok, a hex escape. Need 4 characters
    int value = 0;
    for (int i = 0; i < 4; ++i) {
        if (_inputPtr >= _inputEnd) {
            if (!_loadMore()) {
                _reportInvalidEOF(" in character escape sequence", JsonToken.VALUE_STRING);
            }
        }
        int ch = (int) _inputBuffer[_inputPtr++];
        int digit = CharTypes.charToHex(ch);
        if (digit < 0) {
            _reportUnexpectedChar(ch, "expected a hex-digit for character escape sequence");
        }
        value = (value << 4) | digit;
    }
    return (char) value;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:54,代码来源:UTF8StreamJsonParser.java


示例19: _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


示例20: _decodeEscaped

import com.fasterxml.jackson.core.io.CharTypes; //导入依赖的package包/类
@Override
protected char _decodeEscaped() throws IOException
{
    int c = _inputData.readUnsignedByte();

    switch (c) {
        // First, ones that are mapped
    case 'b':
        return '\b';
    case 't':
        return '\t';
    case 'n':
        return '\n';
    case 'f':
        return '\f';
    case 'r':
        return '\r';

        // And these are to be returned as they are
    case '"':
    case '/':
    case '\\':
        return (char) c;

    case 'u': // and finally hex-escaped
        break;

    default:
        return _handleUnrecognizedCharacterEscape((char) _decodeCharForError(c));
    }

    // Ok, a hex escape. Need 4 characters
    int value = 0;
    for (int i = 0; i < 4; ++i) {
        int ch = _inputData.readUnsignedByte();
        int digit = CharTypes.charToHex(ch);
        if (digit < 0) {
            _reportUnexpectedChar(ch, "expected a hex-digit for character escape sequence");
        }
        value = (value << 4) | digit;
    }
    return (char) value;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:44,代码来源:UTF8DataInputJsonParser.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Affirm类代码示例发布时间:2022-05-23
下一篇:
Java VideoData类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap