Java 类org.codehaus.jackson.util.CharTypes 实例源码

项目:ingress-indonesia-dev    文件:Utf8StreamParser.java   
private final 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)
      {
      case 42:
      default:
        _reportInvalidChar(j);
        break;
      case 10:
        _skipLF();
      case 13:
      }
  }
  return;
  _skipCR();
}
项目:12306-android-Decompile    文件:ReaderBasedParser.java   
protected void _finishString()
  throws IOException, JsonParseException
{
  int i = this._inputPtr;
  int j = this._inputEnd;
  if (i < j)
  {
    int[] arrayOfInt = CharTypes.getInputCodeLatin1();
    int k = arrayOfInt.length;
    do
    {
      int m = this._inputBuffer[i];
      if ((m < k) && (arrayOfInt[m] != 0))
      {
        if (m != 34)
          break;
        this._textBuffer.resetWithShared(this._inputBuffer, this._inputPtr, i - this._inputPtr);
        this._inputPtr = (i + 1);
        return;
      }
      i++;
    }
    while (i < j);
  }
  this._textBuffer.resetWithCopy(this._inputBuffer, this._inputPtr, i - this._inputPtr);
  this._inputPtr = i;
  _finishString2();
}
项目:12306-android-Decompile    文件:ReaderBasedParser.java   
protected final String _parseApostropheFieldName()
  throws IOException, JsonParseException
{
  int i = this._inputPtr;
  int j = this._inputEnd;
  int k = 0;
  int i1;
  if (i < j)
  {
    int[] arrayOfInt = CharTypes.getInputCodeLatin1();
    int n = arrayOfInt.length;
    i1 = this._inputBuffer[i];
    if (i1 == 39)
    {
      int i2 = this._inputPtr;
      this._inputPtr = (i + 1);
      return this._symbols.findSymbol(this._inputBuffer, i2, i - i2, k);
    }
    if ((i1 >= n) || (arrayOfInt[i1] == 0))
      break label110;
  }
  while (true)
  {
    int m = this._inputPtr;
    this._inputPtr = i;
    return _parseFieldName2(m, k, 39);
    label110: k = i1 + k * 31;
    i++;
    if (i < j)
      break;
  }
}
项目:12306-android-Decompile    文件:ReaderBasedParser.java   
protected final String _parseFieldName(int paramInt)
  throws IOException, JsonParseException
{
  if (paramInt != 34)
    return _handleUnusualFieldName(paramInt);
  int i = this._inputPtr;
  int j = this._inputEnd;
  int k = 0;
  if (i < j)
  {
    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, k);
      }
      k = i1 + k * 31;
      i++;
    }
    while (i < j);
  }
  int m = this._inputPtr;
  this._inputPtr = i;
  return _parseFieldName2(m, k, 34);
}
项目:12306-android-Decompile    文件:Utf8StreamParser.java   
private final void _skipCComment()
  throws IOException, JsonParseException
{
  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)
      continue;
    switch (k)
    {
    default:
      _reportInvalidChar(j);
      break;
    case 42:
      if (this._inputBuffer[this._inputPtr] != 47)
        continue;
      this._inputPtr = (1 + this._inputPtr);
      return;
    case 10:
      _skipLF();
      break;
    case 13:
      _skipCR();
    }
  }
  _reportInvalidEOF(" in a comment");
}
项目:12306-android-Decompile    文件:Utf8StreamParser.java   
private final void _skipCppComment()
  throws IOException, JsonParseException
{
  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)
      continue;
    switch (k)
    {
    case 42:
    default:
      _reportInvalidChar(j);
      break;
    case 10:
      _skipLF();
    case 13:
    }
  }
  return;
  _skipCR();
}
项目:12306-android-Decompile    文件:JsonReadContext.java   
public final String toString()
{
  StringBuilder localStringBuilder = new StringBuilder(64);
  switch (this._type)
  {
  default:
  case 0:
  case 1:
    while (true)
    {
      return localStringBuilder.toString();
      localStringBuilder.append("/");
      continue;
      localStringBuilder.append('[');
      localStringBuilder.append(getCurrentIndex());
      localStringBuilder.append(']');
    }
  case 2:
  }
  localStringBuilder.append('{');
  if (this._currentName != null)
  {
    localStringBuilder.append('"');
    CharTypes.appendQuoted(localStringBuilder, this._currentName);
    localStringBuilder.append('"');
  }
  while (true)
  {
    localStringBuilder.append(']');
    break;
    localStringBuilder.append('?');
  }
}
项目:12306-android-Decompile    文件:CharacterEscapes.java   
public static int[] standardAsciiEscapesForJSON()
{
  int[] arrayOfInt1 = CharTypes.get7BitOutputEscapes();
  int[] arrayOfInt2 = new int[arrayOfInt1.length];
  System.arraycopy(arrayOfInt1, 0, arrayOfInt2, 0, arrayOfInt1.length);
  return arrayOfInt2;
}
项目:RHome    文件:JsonReadContext.java   
/**
 * Overridden to provide developer readable "JsonPath" representation
 * of the context.
 */
public final 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();
}
项目:12306-android-Decompile    文件:ReaderBasedParser.java   
protected void _finishString()
  throws IOException, JsonParseException
{
  int i = this._inputPtr;
  int j = this._inputEnd;
  if (i < j)
  {
    int[] arrayOfInt = CharTypes.getInputCodeLatin1();
    int k = arrayOfInt.length;
    do
    {
      int m = this._inputBuffer[i];
      if ((m < k) && (arrayOfInt[m] != 0))
      {
        if (m != 34)
          break;
        this._textBuffer.resetWithShared(this._inputBuffer, this._inputPtr, i - this._inputPtr);
        this._inputPtr = (i + 1);
        return;
      }
      i++;
    }
    while (i < j);
  }
  this._textBuffer.resetWithCopy(this._inputBuffer, this._inputPtr, i - this._inputPtr);
  this._inputPtr = i;
  _finishString2();
}
项目:12306-android-Decompile    文件:ReaderBasedParser.java   
protected final String _parseApostropheFieldName()
  throws IOException, JsonParseException
{
  int i = this._inputPtr;
  int j = this._inputEnd;
  int k = 0;
  int i1;
  if (i < j)
  {
    int[] arrayOfInt = CharTypes.getInputCodeLatin1();
    int n = arrayOfInt.length;
    i1 = this._inputBuffer[i];
    if (i1 == 39)
    {
      int i2 = this._inputPtr;
      this._inputPtr = (i + 1);
      return this._symbols.findSymbol(this._inputBuffer, i2, i - i2, k);
    }
    if ((i1 >= n) || (arrayOfInt[i1] == 0))
      break label110;
  }
  while (true)
  {
    int m = this._inputPtr;
    this._inputPtr = i;
    return _parseFieldName2(m, k, 39);
    label110: k = i1 + k * 31;
    i++;
    if (i < j)
      break;
  }
}
项目:12306-android-Decompile    文件:ReaderBasedParser.java   
protected final String _parseFieldName(int paramInt)
  throws IOException, JsonParseException
{
  if (paramInt != 34)
    return _handleUnusualFieldName(paramInt);
  int i = this._inputPtr;
  int j = this._inputEnd;
  int k = 0;
  if (i < j)
  {
    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, k);
      }
      k = i1 + k * 31;
      i++;
    }
    while (i < j);
  }
  int m = this._inputPtr;
  this._inputPtr = i;
  return _parseFieldName2(m, k, 34);
}
项目:12306-android-Decompile    文件:Utf8StreamParser.java   
private final void _skipCComment()
  throws IOException, JsonParseException
{
  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)
      continue;
    switch (k)
    {
    default:
      _reportInvalidChar(j);
      break;
    case 42:
      if (this._inputBuffer[this._inputPtr] != 47)
        continue;
      this._inputPtr = (1 + this._inputPtr);
      return;
    case 10:
      _skipLF();
      break;
    case 13:
      _skipCR();
    }
  }
  _reportInvalidEOF(" in a comment");
}
项目:12306-android-Decompile    文件:Utf8StreamParser.java   
private final void _skipCppComment()
  throws IOException, JsonParseException
{
  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)
      continue;
    switch (k)
    {
    case 42:
    default:
      _reportInvalidChar(j);
      break;
    case 10:
      _skipLF();
    case 13:
    }
  }
  return;
  _skipCR();
}
项目:12306-android-Decompile    文件:JsonReadContext.java   
public final String toString()
{
  StringBuilder localStringBuilder = new StringBuilder(64);
  switch (this._type)
  {
  default:
  case 0:
  case 1:
    while (true)
    {
      return localStringBuilder.toString();
      localStringBuilder.append("/");
      continue;
      localStringBuilder.append('[');
      localStringBuilder.append(getCurrentIndex());
      localStringBuilder.append(']');
    }
  case 2:
  }
  localStringBuilder.append('{');
  if (this._currentName != null)
  {
    localStringBuilder.append('"');
    CharTypes.appendQuoted(localStringBuilder, this._currentName);
    localStringBuilder.append('"');
  }
  while (true)
  {
    localStringBuilder.append(']');
    break;
    localStringBuilder.append('?');
  }
}
项目:12306-android-Decompile    文件:CharacterEscapes.java   
public static int[] standardAsciiEscapesForJSON()
{
  int[] arrayOfInt1 = CharTypes.get7BitOutputEscapes();
  int[] arrayOfInt2 = new int[arrayOfInt1.length];
  System.arraycopy(arrayOfInt1, 0, arrayOfInt2, 0, arrayOfInt1.length);
  return arrayOfInt2;
}
项目:ingress-indonesia-dev    文件:ReaderBasedParser.java   
protected final void _finishString()
{
  int i = this._inputPtr;
  int j = this._inputEnd;
  if (i < j)
  {
    int[] arrayOfInt = CharTypes.getInputCodeLatin1();
    int k = arrayOfInt.length;
    do
    {
      int m = this._inputBuffer[i];
      if ((m < k) && (arrayOfInt[m] != 0))
      {
        if (m != 34)
          break;
        this._textBuffer.resetWithShared(this._inputBuffer, this._inputPtr, i - this._inputPtr);
        this._inputPtr = (i + 1);
        return;
      }
      i++;
    }
    while (i < j);
  }
  this._textBuffer.resetWithCopy(this._inputBuffer, this._inputPtr, i - this._inputPtr);
  this._inputPtr = i;
  _finishString2();
}
项目:ingress-indonesia-dev    文件:ReaderBasedParser.java   
protected final String _parseApostropheFieldName()
{
  int i = this._inputPtr;
  int j = this._inputEnd;
  int k = 0;
  if (i < j)
  {
    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, k);
      }
      if ((i1 < n) && (arrayOfInt[i1] != 0))
        break;
      k = i1 + k * 31;
      i++;
    }
    while (i < j);
  }
  int m = this._inputPtr;
  this._inputPtr = i;
  return _parseFieldName2(m, k, 39);
}
项目:ingress-indonesia-dev    文件:ReaderBasedParser.java   
protected final String _parseFieldName(int paramInt)
{
  if (paramInt != 34)
    return _handleUnusualFieldName(paramInt);
  int i = this._inputPtr;
  int j = this._inputEnd;
  int k = 0;
  if (i < j)
  {
    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, k);
      }
      k = i1 + k * 31;
      i++;
    }
    while (i < j);
  }
  int m = this._inputPtr;
  this._inputPtr = i;
  return _parseFieldName2(m, k, 34);
}
项目:ingress-indonesia-dev    文件:Utf8StreamParser.java   
private final void _skipCComment()
{
  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:
        _reportInvalidChar(j);
        break;
      case 42:
        if (this._inputBuffer[this._inputPtr] == 47)
        {
          this._inputPtr = (1 + this._inputPtr);
          return;
        }
        break;
      case 10:
        _skipLF();
        break;
      case 13:
        _skipCR();
      }
  }
  _reportInvalidEOF(" in a comment");
}
项目:ingress-indonesia-dev    文件:JsonReadContext.java   
public final String toString()
{
  StringBuilder localStringBuilder = new StringBuilder(64);
  switch (this._type)
  {
  default:
  case 0:
  case 1:
    while (true)
    {
      return localStringBuilder.toString();
      localStringBuilder.append("/");
      continue;
      localStringBuilder.append('[');
      localStringBuilder.append(getCurrentIndex());
      localStringBuilder.append(']');
    }
  case 2:
  }
  localStringBuilder.append('{');
  if (this._currentName != null)
  {
    localStringBuilder.append('"');
    CharTypes.appendQuoted(localStringBuilder, this._currentName);
    localStringBuilder.append('"');
  }
  while (true)
  {
    localStringBuilder.append('}');
    break;
    localStringBuilder.append('?');
  }
}
项目:12306-android-Decompile    文件:ReaderBasedParser.java   
protected final char _decodeEscaped()
  throws IOException, JsonParseException
{
  if ((this._inputPtr >= this._inputEnd) && (!loadMore()))
    _reportInvalidEOF(" in character escape sequence");
  char[] arrayOfChar1 = this._inputBuffer;
  int i = this._inputPtr;
  this._inputPtr = (i + 1);
  char c = arrayOfChar1[i];
  switch (c)
  {
  default:
    c = _handleUnrecognizedCharacterEscape(c);
  case '"':
  case '/':
  case '\\':
    return c;
  case 'b':
    return '\b';
  case 't':
    return '\t';
  case 'n':
    return '\n';
  case 'f':
    return '\f';
  case 'r':
    return '\r';
  case 'u':
  }
  int j = 0;
  for (int k = 0; k < 4; k++)
  {
    if ((this._inputPtr >= this._inputEnd) && (!loadMore()))
      _reportInvalidEOF(" in character escape sequence");
    char[] arrayOfChar2 = this._inputBuffer;
    int m = this._inputPtr;
    this._inputPtr = (m + 1);
    int n = arrayOfChar2[m];
    int i1 = CharTypes.charToHex(n);
    if (i1 < 0)
      _reportUnexpectedChar(n, "expected a hex-digit for character escape sequence");
    j = i1 | j << 4;
  }
  return (char)j;
}
项目:12306-android-Decompile    文件:Utf8StreamParser.java   
protected final char _decodeEscaped()
  throws IOException, JsonParseException
{
  if ((this._inputPtr >= this._inputEnd) && (!loadMore()))
    _reportInvalidEOF(" in character escape sequence");
  byte[] arrayOfByte1 = this._inputBuffer;
  int i = this._inputPtr;
  this._inputPtr = (i + 1);
  int j = arrayOfByte1[i];
  switch (j)
  {
  default:
    return _handleUnrecognizedCharacterEscape((char)_decodeCharForError(j));
  case 98:
    return '\b';
  case 116:
    return '\t';
  case 110:
    return '\n';
  case 102:
    return '\f';
  case 114:
    return '\r';
  case 34:
  case 47:
  case 92:
    return (char)j;
  case 117:
  }
  int k = 0;
  for (int m = 0; m < 4; m++)
  {
    if ((this._inputPtr >= this._inputEnd) && (!loadMore()))
      _reportInvalidEOF(" in character escape sequence");
    byte[] arrayOfByte2 = this._inputBuffer;
    int n = this._inputPtr;
    this._inputPtr = (n + 1);
    int i1 = arrayOfByte2[n];
    int i2 = CharTypes.charToHex(i1);
    if (i2 < 0)
      _reportUnexpectedChar(i1, "expected a hex-digit for character escape sequence");
    k = i2 | k << 4;
  }
  return (char)k;
}
项目:12306-android-Decompile    文件:Utf8StreamParser.java   
protected final Name _handleUnusualFieldName(int paramInt)
  throws IOException, JsonParseException
{
  Name localName;
  if ((paramInt == 39) && (isEnabled(JsonParser.Feature.ALLOW_SINGLE_QUOTES)))
  {
    localName = _parseApostropheFieldName();
    return localName;
  }
  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");
  int[] arrayOfInt2 = this._quadBuffer;
  int i = 0;
  int j = 0;
  int m;
  for (int k = 0; ; k = m)
  {
    if (j < 4)
    {
      j++;
      i = paramInt | i << 8;
      m = k;
    }
    while (true)
    {
      if ((this._inputPtr >= this._inputEnd) && (!loadMore()))
        _reportInvalidEOF(" in field name");
      paramInt = 0xFF & this._inputBuffer[this._inputPtr];
      if (arrayOfInt1[paramInt] == 0)
        break label249;
      if (j > 0)
      {
        if (m >= arrayOfInt2.length)
        {
          arrayOfInt2 = growArrayBy(arrayOfInt2, arrayOfInt2.length);
          this._quadBuffer = arrayOfInt2;
        }
        int n = m + 1;
        arrayOfInt2[m] = i;
        m = n;
      }
      localName = this._symbols.findName(arrayOfInt2, m);
      if (localName != null)
        break;
      return addName(arrayOfInt2, m, j);
      if (k >= arrayOfInt2.length)
      {
        arrayOfInt2 = growArrayBy(arrayOfInt2, arrayOfInt2.length);
        this._quadBuffer = arrayOfInt2;
      }
      m = k + 1;
      arrayOfInt2[k] = i;
      i = paramInt;
      j = 1;
    }
    label249: this._inputPtr = (1 + this._inputPtr);
  }
}
项目:12306-android-Decompile    文件:TextNode.java   
protected static void appendQuoted(StringBuilder paramStringBuilder, String paramString)
{
  paramStringBuilder.append('"');
  CharTypes.appendQuoted(paramStringBuilder, paramString);
  paramStringBuilder.append('"');
}
项目:RHome    文件:WriterBasedGenerator.java   
private void _writeString(String text)
    throws IOException, JsonGenerationException
{
    /* One check first: if String won't fit in the buffer, let's
     * segment writes. No point in extending buffer to huge sizes
     * (like if someone wants to include multi-megabyte base64
     * encoded stuff or such)
     */
    int len = text.length();
    if (len > _outputEnd) { // Let's reserve space for entity at begin/end
        _writeLongString(text);
        return;
    }

    // Ok: we know String will fit in buffer ok
    // But do we need to flush first?
    if ((_outputTail + len) > _outputEnd) {
        _flushBuffer();
    }
    text.getChars(0, len, _outputBuffer, _outputTail);

    // And then we'll need to verify need for escaping etc:
    int end = _outputTail + len;
    final int[] escCodes = CharTypes.getOutputEscapes();
    final int escLen = escCodes.length;

    output_loop:
    while (_outputTail < end) {
        // Fast loop for chars not needing escaping
        escape_loop:
        while (true) {
            char c = _outputBuffer[_outputTail];
            if (c < escLen && escCodes[c] != 0) {
                break escape_loop;
            }
            if (++_outputTail >= end) {
                break output_loop;
            }
        }

        // Ok, bumped into something that needs escaping.
        /* First things first: need to flush the buffer.
         * Inlined, as we don't want to lose tail pointer
         */
        int flushLen = (_outputTail - _outputHead);
        if (flushLen > 0) {
            _writer.write(_outputBuffer, _outputHead, flushLen);
        }
        /* In any case, tail will be the new start, so hopefully
         * we have room now.
         */
        {
            int escCode = escCodes[_outputBuffer[_outputTail]];
            ++_outputTail;
            int needLen = (escCode < 0) ? 6 : 2;
            // If not, need to call separate method (note: buffer is empty now)
            if (needLen > _outputTail) {
                _outputHead = _outputTail;
                _writeSingleEscape(escCode);
            } else {
                // But if it fits, can just prepend to buffer
                int ptr = _outputTail - needLen;
                _outputHead = ptr;
                _appendSingleEscape(escCode, _outputBuffer, ptr);
            }
        }
    }
}
项目:RHome    文件:WriterBasedGenerator.java   
/**
 * Method called to output textual context which has been copied
 * to the output buffer prior to call. If any escaping is needed,
 * it will also be handled by the method.
 *<p>
 * Note: when called, textual content to write is within output
 * buffer, right after buffered content (if any). That's why only
 * length of that text is passed, as buffer and offset are implied.
 */
private final void _writeSegment(int end)
    throws IOException, JsonGenerationException
{
    final int[] escCodes = CharTypes.getOutputEscapes();
    final int escLen = escCodes.length;

    int ptr = 0;

    output_loop:
    while (ptr < end) {
        // Fast loop for chars not needing escaping
        int start = ptr;
        while (true) {
            char c = _outputBuffer[ptr];
            if (c < escLen && escCodes[c] != 0) {
                break;
            }
            if (++ptr >= end) {
                break;
            }
        }

        // Ok, bumped into something that needs escaping.
        /* First things first: need to flush the buffer.
         * Inlined, as we don't want to lose tail pointer
         */
        int flushLen = (ptr - start);
        if (flushLen > 0) {
            _writer.write(_outputBuffer, start, flushLen);
            if (ptr >= end) {
                break output_loop;
            }
        }
        /* In any case, tail will be the new start, so hopefully
         * we have room now.
         */
        {
            int escCode = escCodes[_outputBuffer[ptr]];
            ++ptr;
            int needLen = (escCode < 0) ? 6 : 2;
            // If not, need to call separate method (note: buffer is empty now)
            if (needLen > _outputTail) {
                _writeSingleEscape(escCode);
            } else {
                // But if it fits, can just prepend to buffer
                ptr -= needLen;
                _appendSingleEscape(escCode, _outputBuffer, ptr);
            }
        }
    }
}
项目:RHome    文件:WriterBasedGenerator.java   
/**
 * This method called when the string content is already in
 * a char buffer, and need not be copied for processing.
 */
private void _writeString(char[] text, int offset, int len)
    throws IOException, JsonGenerationException
{
    /* Let's just find longest spans of non-escapable
     * content, and for each see if it makes sense
     * to copy them, or write through
     */
    len += offset; // -> len marks the end from now on
    final int[] escCodes = CharTypes.getOutputEscapes();
    final int escLen = escCodes.length;
    while (offset < len) {
        int start = offset;

        while (true) {
            char c = text[offset];
            if (c < escLen && escCodes[c] != 0) {
                break;
            }
            if (++offset >= len) {
                break;
            }
        }

        // Short span? Better just copy it to buffer first:
        int newAmount = offset - start;
        if (newAmount < SHORT_WRITE) {
            // Note: let's reserve room for escaped char (up to 6 chars)
            if ((_outputTail + newAmount) > _outputEnd) {
                _flushBuffer();
            }
            if (newAmount > 0) {
                System.arraycopy(text, start, _outputBuffer, _outputTail, newAmount);
                _outputTail += newAmount;
            }
        } else { // Nope: better just write through
            _flushBuffer();
            _writer.write(text, start, newAmount);
        }
        // Was this the end?
        if (offset >= len) { // yup
            break;
        }
        // Nope, need to escape the char.
        int escCode = escCodes[text[offset]];
        ++offset;
        int needLen = (escCode < 0) ? 6 : 2;
        if ((_outputTail + needLen) > _outputEnd) {
            _flushBuffer();
        }
        _appendSingleEscape(escCode, _outputBuffer, _outputTail);
        _outputTail += needLen;
    }
}
项目:RHome    文件:TextNode.java   
protected static void appendQuoted(StringBuilder sb, String content)
{
    sb.append('"');
    CharTypes.appendQuoted(sb, content);
    sb.append('"');
}
项目:12306-android-Decompile    文件:ReaderBasedParser.java   
protected final char _decodeEscaped()
  throws IOException, JsonParseException
{
  if ((this._inputPtr >= this._inputEnd) && (!loadMore()))
    _reportInvalidEOF(" in character escape sequence");
  char[] arrayOfChar1 = this._inputBuffer;
  int i = this._inputPtr;
  this._inputPtr = (i + 1);
  char c = arrayOfChar1[i];
  switch (c)
  {
  default:
    c = _handleUnrecognizedCharacterEscape(c);
  case '"':
  case '/':
  case '\\':
    return c;
  case 'b':
    return '\b';
  case 't':
    return '\t';
  case 'n':
    return '\n';
  case 'f':
    return '\f';
  case 'r':
    return '\r';
  case 'u':
  }
  int j = 0;
  for (int k = 0; k < 4; k++)
  {
    if ((this._inputPtr >= this._inputEnd) && (!loadMore()))
      _reportInvalidEOF(" in character escape sequence");
    char[] arrayOfChar2 = this._inputBuffer;
    int m = this._inputPtr;
    this._inputPtr = (m + 1);
    int n = arrayOfChar2[m];
    int i1 = CharTypes.charToHex(n);
    if (i1 < 0)
      _reportUnexpectedChar(n, "expected a hex-digit for character escape sequence");
    j = i1 | j << 4;
  }
  return (char)j;
}
项目:12306-android-Decompile    文件:Utf8StreamParser.java   
protected final char _decodeEscaped()
  throws IOException, JsonParseException
{
  if ((this._inputPtr >= this._inputEnd) && (!loadMore()))
    _reportInvalidEOF(" in character escape sequence");
  byte[] arrayOfByte1 = this._inputBuffer;
  int i = this._inputPtr;
  this._inputPtr = (i + 1);
  int j = arrayOfByte1[i];
  switch (j)
  {
  default:
    return _handleUnrecognizedCharacterEscape((char)_decodeCharForError(j));
  case 98:
    return '\b';
  case 116:
    return '\t';
  case 110:
    return '\n';
  case 102:
    return '\f';
  case 114:
    return '\r';
  case 34:
  case 47:
  case 92:
    return (char)j;
  case 117:
  }
  int k = 0;
  for (int m = 0; m < 4; m++)
  {
    if ((this._inputPtr >= this._inputEnd) && (!loadMore()))
      _reportInvalidEOF(" in character escape sequence");
    byte[] arrayOfByte2 = this._inputBuffer;
    int n = this._inputPtr;
    this._inputPtr = (n + 1);
    int i1 = arrayOfByte2[n];
    int i2 = CharTypes.charToHex(i1);
    if (i2 < 0)
      _reportUnexpectedChar(i1, "expected a hex-digit for character escape sequence");
    k = i2 | k << 4;
  }
  return (char)k;
}
项目:12306-android-Decompile    文件:Utf8StreamParser.java   
protected final Name _handleUnusualFieldName(int paramInt)
  throws IOException, JsonParseException
{
  Name localName;
  if ((paramInt == 39) && (isEnabled(JsonParser.Feature.ALLOW_SINGLE_QUOTES)))
  {
    localName = _parseApostropheFieldName();
    return localName;
  }
  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");
  int[] arrayOfInt2 = this._quadBuffer;
  int i = 0;
  int j = 0;
  int m;
  for (int k = 0; ; k = m)
  {
    if (j < 4)
    {
      j++;
      i = paramInt | i << 8;
      m = k;
    }
    while (true)
    {
      if ((this._inputPtr >= this._inputEnd) && (!loadMore()))
        _reportInvalidEOF(" in field name");
      paramInt = 0xFF & this._inputBuffer[this._inputPtr];
      if (arrayOfInt1[paramInt] == 0)
        break label249;
      if (j > 0)
      {
        if (m >= arrayOfInt2.length)
        {
          arrayOfInt2 = growArrayBy(arrayOfInt2, arrayOfInt2.length);
          this._quadBuffer = arrayOfInt2;
        }
        int n = m + 1;
        arrayOfInt2[m] = i;
        m = n;
      }
      localName = this._symbols.findName(arrayOfInt2, m);
      if (localName != null)
        break;
      return addName(arrayOfInt2, m, j);
      if (k >= arrayOfInt2.length)
      {
        arrayOfInt2 = growArrayBy(arrayOfInt2, arrayOfInt2.length);
        this._quadBuffer = arrayOfInt2;
      }
      m = k + 1;
      arrayOfInt2[k] = i;
      i = paramInt;
      j = 1;
    }
    label249: this._inputPtr = (1 + this._inputPtr);
  }
}
项目:12306-android-Decompile    文件:TextNode.java   
protected static void appendQuoted(StringBuilder paramStringBuilder, String paramString)
{
  paramStringBuilder.append('"');
  CharTypes.appendQuoted(paramStringBuilder, paramString);
  paramStringBuilder.append('"');
}
项目:ingress-indonesia-dev    文件:ReaderBasedParser.java   
protected final char _decodeEscaped()
{
  int i = 0;
  if ((this._inputPtr >= this._inputEnd) && (!loadMore()))
    _reportInvalidEOF(" in character escape sequence");
  char[] arrayOfChar1 = this._inputBuffer;
  int j = this._inputPtr;
  this._inputPtr = (j + 1);
  char c = arrayOfChar1[j];
  switch (c)
  {
  default:
    c = _handleUnrecognizedCharacterEscape(c);
  case '"':
  case '/':
  case '\\':
    return c;
  case 'b':
    return '\b';
  case 't':
    return '\t';
  case 'n':
    return '\n';
  case 'f':
    return '\f';
  case 'r':
    return '\r';
  case 'u':
  }
  for (int k = 0; k < 4; k++)
  {
    if ((this._inputPtr >= this._inputEnd) && (!loadMore()))
      _reportInvalidEOF(" in character escape sequence");
    char[] arrayOfChar2 = this._inputBuffer;
    int m = this._inputPtr;
    this._inputPtr = (m + 1);
    int n = arrayOfChar2[m];
    int i1 = CharTypes.charToHex(n);
    if (i1 < 0)
      _reportUnexpectedChar(n, "expected a hex-digit for character escape sequence");
    i = i1 | i << 4;
  }
  return (char)i;
}
项目:ingress-indonesia-dev    文件:Utf8StreamParser.java   
protected final char _decodeEscaped()
{
  int i = 0;
  if ((this._inputPtr >= this._inputEnd) && (!loadMore()))
    _reportInvalidEOF(" in character escape sequence");
  byte[] arrayOfByte1 = this._inputBuffer;
  int j = this._inputPtr;
  this._inputPtr = (j + 1);
  int k = arrayOfByte1[j];
  switch (k)
  {
  default:
    return _handleUnrecognizedCharacterEscape((char)_decodeCharForError(k));
  case 98:
    return '\b';
  case 116:
    return '\t';
  case 110:
    return '\n';
  case 102:
    return '\f';
  case 114:
    return '\r';
  case 34:
  case 47:
  case 92:
    return (char)k;
  case 117:
  }
  int m = 0;
  while (i < 4)
  {
    if ((this._inputPtr >= this._inputEnd) && (!loadMore()))
      _reportInvalidEOF(" in character escape sequence");
    byte[] arrayOfByte2 = this._inputBuffer;
    int n = this._inputPtr;
    this._inputPtr = (n + 1);
    int i1 = arrayOfByte2[n];
    int i2 = CharTypes.charToHex(i1);
    if (i2 < 0)
      _reportUnexpectedChar(i1, "expected a hex-digit for character escape sequence");
    m = i2 | m << 4;
    i++;
  }
  return (char)m;
}
项目:ingress-indonesia-dev    文件:Utf8StreamParser.java   
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");
  int[] arrayOfInt2 = this._quadBuffer;
  int i = 0;
  int j = 0;
  int k = paramInt;
  int m = 0;
  Object localObject1 = arrayOfInt2;
  int i2;
  int i3;
  Object localObject2;
  int i1;
  if (i < 4)
  {
    int i6 = i + 1;
    i2 = k | j << 8;
    i3 = m;
    localObject2 = localObject1;
    i1 = i6;
  }
  while (true)
  {
    if ((this._inputPtr >= this._inputEnd) && (!loadMore()))
      _reportInvalidEOF(" in field name");
    int i4 = 0xFF & this._inputBuffer[this._inputPtr];
    if (arrayOfInt1[i4] != 0)
      break label246;
    this._inputPtr = (1 + this._inputPtr);
    j = i2;
    i = i1;
    localObject1 = localObject2;
    m = i3;
    k = i4;
    break;
    if (m >= localObject1.length)
    {
      localObject1 = growArrayBy((int[])localObject1, localObject1.length);
      this._quadBuffer = ((int[])localObject1);
    }
    int n = m + 1;
    localObject1[m] = j;
    localObject2 = localObject1;
    i1 = 1;
    i2 = k;
    i3 = n;
  }
  label246: if (i1 > 0)
  {
    if (i3 >= localObject2.length)
    {
      localObject2 = growArrayBy((int[])localObject2, localObject2.length);
      this._quadBuffer = ((int[])localObject2);
    }
    int i5 = i3 + 1;
    localObject2[i3] = i2;
    i3 = i5;
  }
  Name localName = this._symbols.findName((int[])localObject2, i3);
  if (localName == null)
    return addName((int[])localObject2, i3, i1);
  return localName;
}
项目:ingress-indonesia-dev    文件:TextNode.java   
protected static void appendQuoted(StringBuilder paramStringBuilder, String paramString)
{
  paramStringBuilder.append('"');
  CharTypes.appendQuoted(paramStringBuilder, paramString);
  paramStringBuilder.append('"');
}