private int _appendByteEscape(int paramInt1, int paramInt2, ByteArrayBuilder paramByteArrayBuilder, int paramInt3)
 {
   paramByteArrayBuilder.setCurrentSegmentLength(paramInt3);
   paramByteArrayBuilder.append(92);
   if (paramInt2 < 0)
   {
     paramByteArrayBuilder.append(117);
     if (paramInt1 > 255)
     {
       int i = paramInt1 >> 8;
       paramByteArrayBuilder.append(HEX_BYTES[(i >> 4)]);
       paramByteArrayBuilder.append(HEX_BYTES[(i & 0xF)]);
       paramInt1 &= 255;
       paramByteArrayBuilder.append(HEX_BYTES[(paramInt1 >> 4)]);
       paramByteArrayBuilder.append(HEX_BYTES[(paramInt1 & 0xF)]);
     }
   }
   while (true)
   {
     return paramByteArrayBuilder.getCurrentSegmentLength();
     paramByteArrayBuilder.append(48);
     paramByteArrayBuilder.append(48);
     break;
     paramByteArrayBuilder.append((byte)paramInt2);
   }
 }
 /**
  * Method that can be used to serialize any Java value as a byte array. Functionally equivalent to
  * calling {@link #writeValue(Writer,Object)} with {@link java.io.ByteArrayOutputStream} and
  * getting bytes, but more efficient. Encoding used will be UTF-8.
  *
  * <p>Note: prior to version 2.1, throws clause included {@link IOException}; 2.1 removed it.
  */
 public byte[] writeValueAsBytes(Object value) throws JsonProcessingException {
   ByteArrayBuilder bb = new ByteArrayBuilder(_jsonFactory._getBufferRecycler());
   try {
     _configAndWriteValue(_jsonFactory.createJsonGenerator(bb, JsonEncoding.UTF8), value);
   } catch (JsonProcessingException e) { // to support [JACKSON-758]
     throw e;
   } catch (IOException e) { // shouldn't really happen, but is declared as possibility so:
     throw JsonMappingException.fromUnexpectedIOE(e);
   }
   byte[] result = bb.toByteArray();
   bb.release();
   return result;
 }
  /**
   * Convenience method for decoding contents of a Base64-encoded String, using this variant's
   * settings and appending decoded binary data using provided {@link ByteArrayBuilder}.
   *
   * <p>NOTE: builder will NOT be reset before decoding (nor cleared afterwards); assumption is that
   * caller will ensure it is given in proper state, and used as appropriate afterwards.
   *
   * @since 2.3
   * @throws IllegalArgumentException if input is not valid base64 encoded data
   */
  public void decode(String str, ByteArrayBuilder builder) throws IllegalArgumentException {
    int ptr = 0;
    int len = str.length();

    while (ptr < len) {
      // first, we'll skip preceding white space, if any
      char ch;
      do {
        ch = str.charAt(ptr++);
      } while ((ptr < len) && (ch <= INT_SPACE));
      int bits = decodeBase64Char(ch);
      if (bits < 0) {
        _reportInvalidBase64(ch, 0, null);
      }
      int decodedData = bits;
      // then second base64 char; can't get padding yet, nor ws
      if (ptr >= len) {
        _reportBase64EOF();
      }
      ch = str.charAt(ptr++);
      bits = decodeBase64Char(ch);
      if (bits < 0) {
        _reportInvalidBase64(ch, 1, null);
      }
      decodedData = (decodedData << 6) | bits;
      // third base64 char; can be padding, but not ws
      if (ptr >= len) {
        // but as per [JACKSON-631] can be end-of-input, iff not using padding
        if (!usesPadding()) {
          decodedData >>= 4;
          builder.append(decodedData);
          break;
        }
        _reportBase64EOF();
      }
      ch = str.charAt(ptr++);
      bits = decodeBase64Char(ch);

      // First branch: can get padding (-> 1 byte)
      if (bits < 0) {
        if (bits != Base64Variant.BASE64_VALUE_PADDING) {
          _reportInvalidBase64(ch, 2, null);
        }
        // Ok, must get padding
        if (ptr >= len) {
          _reportBase64EOF();
        }
        ch = str.charAt(ptr++);
        if (!usesPaddingChar(ch)) {
          _reportInvalidBase64(ch, 3, "expected padding character '" + getPaddingChar() + "'");
        }
        // Got 12 bits, only need 8, need to shift
        decodedData >>= 4;
        builder.append(decodedData);
        continue;
      }
      // Nope, 2 or 3 bytes
      decodedData = (decodedData << 6) | bits;
      // fourth and last base64 char; can be padding, but not ws
      if (ptr >= len) {
        // but as per [JACKSON-631] can be end-of-input, iff not using padding
        if (!usesPadding()) {
          decodedData >>= 2;
          builder.appendTwoBytes(decodedData);
          break;
        }
        _reportBase64EOF();
      }
      ch = str.charAt(ptr++);
      bits = decodeBase64Char(ch);
      if (bits < 0) {
        if (bits != Base64Variant.BASE64_VALUE_PADDING) {
          _reportInvalidBase64(ch, 3, null);
        }
        decodedData >>= 2;
        builder.appendTwoBytes(decodedData);
      } else {
        // otherwise, our triple is now complete
        decodedData = (decodedData << 6) | bits;
        builder.appendThreeBytes(decodedData);
      }
    }
  }
 /**
  * Convenience method for decoding contents of a Base64-encoded String, using this variant's
  * settings.
  *
  * @param input
  * @since 2.2.3
  * @throws IllegalArgumentException if input is not valid base64 encoded data
  */
 @SuppressWarnings("resource")
 public byte[] decode(String input) throws IllegalArgumentException {
   ByteArrayBuilder b = new ByteArrayBuilder();
   decode(input, b);
   return b.toByteArray();
 }
 public byte[] encodeAsUTF8(String paramString)
 {
   ByteArrayBuilder localByteArrayBuilder = this._byteBuilder;
   if (localByteArrayBuilder == null)
   {
     localByteArrayBuilder = new ByteArrayBuilder(null);
     this._byteBuilder = localByteArrayBuilder;
   }
   int i = paramString.length();
   Object localObject1 = localByteArrayBuilder.resetAndGetFirstSegment();
   int j = localObject1.length;
   int k = 0;
   int m = 0;
   int i1;
   int i2;
   Object localObject2;
   int i4;
   int i5;
   label81: int i18;
   if (m < i)
   {
     i1 = m + 1;
     i2 = paramString.charAt(m);
     int i3 = j;
     localObject2 = localObject1;
     i4 = k;
     i5 = i3;
     if (i2 <= 127)
     {
       if (i4 >= i5)
       {
         localObject2 = localByteArrayBuilder.finishCurrentSegment();
         i5 = localObject2.length;
         i4 = 0;
       }
       i18 = i4 + 1;
       localObject2[i4] = ((byte)i2);
       if (i1 < i);
     }
   }
   for (int n = i18; ; n = k)
   {
     return this._byteBuilder.completeAndCoalesce(n);
     int i19 = i1 + 1;
     i2 = paramString.charAt(i1);
     i1 = i19;
     i4 = i18;
     break label81;
     if (i4 >= i5)
     {
       localObject2 = localByteArrayBuilder.finishCurrentSegment();
       i5 = localObject2.length;
     }
     for (int i6 = 0; ; i6 = i4)
     {
       int i9;
       int i10;
       if (i2 < 2048)
       {
         i9 = i6 + 1;
         localObject2[i6] = ((byte)(0xC0 | i2 >> 6));
         i10 = i2;
       }
       for (m = i1; ; m = i1)
       {
         if (i9 >= i5)
         {
           localObject2 = localByteArrayBuilder.finishCurrentSegment();
           i5 = localObject2.length;
           i9 = 0;
         }
         int i11 = i9 + 1;
         localObject2[i9] = ((byte)(0x80 | i10 & 0x3F));
         localObject1 = localObject2;
         j = i5;
         k = i11;
         break;
         if ((i2 >= 55296) && (i2 <= 57343))
           break label378;
         int i7 = i6 + 1;
         localObject2[i6] = ((byte)(0xE0 | i2 >> 12));
         if (i7 >= i5)
         {
           localObject2 = localByteArrayBuilder.finishCurrentSegment();
           i5 = localObject2.length;
           i7 = 0;
         }
         int i8 = i7 + 1;
         localObject2[i7] = ((byte)(0x80 | 0x3F & i2 >> 6));
         i9 = i8;
         i10 = i2;
       }
       label378: if (i2 > 56319)
         _illegalSurrogate(i2);
       if (i1 >= i)
         _illegalSurrogate(i2);
       int i12 = i1 + 1;
       int i13 = _convertSurrogate(i2, paramString.charAt(i1));
       if (i13 > 1114111)
         _illegalSurrogate(i13);
       int i14 = i6 + 1;
       localObject2[i6] = ((byte)(0xF0 | i13 >> 18));
       if (i14 >= i5)
       {
         localObject2 = localByteArrayBuilder.finishCurrentSegment();
         i5 = localObject2.length;
         i14 = 0;
       }
       int i15 = i14 + 1;
       localObject2[i14] = ((byte)(0x80 | 0x3F & i13 >> 12));
       if (i15 >= i5)
       {
         localObject2 = localByteArrayBuilder.finishCurrentSegment();
         i5 = localObject2.length;
       }
       for (int i16 = 0; ; i16 = i15)
       {
         int i17 = i16 + 1;
         localObject2[i16] = ((byte)(0x80 | 0x3F & i13 >> 6));
         i9 = i17;
         i10 = i13;
         m = i12;
         break;
       }
     }
   }
 }
 public byte[] quoteAsUTF8(String paramString)
 {
   ByteArrayBuilder localByteArrayBuilder = this._byteBuilder;
   if (localByteArrayBuilder == null)
   {
     localByteArrayBuilder = new ByteArrayBuilder(null);
     this._byteBuilder = localByteArrayBuilder;
   }
   int i = paramString.length();
   Object localObject1 = localByteArrayBuilder.resetAndGetFirstSegment();
   int j = 0;
   int k = 0;
   label51: int m;
   int n;
   int i1;
   while (k < i)
   {
     int[] arrayOfInt = CharTypes.get7BitOutputEscapes();
     m = paramString.charAt(k);
     if ((m > 127) || (arrayOfInt[m] != 0))
     {
       if (j >= localObject1.length)
       {
         localObject1 = localByteArrayBuilder.finishCurrentSegment();
         j = 0;
       }
       n = k + 1;
       i1 = paramString.charAt(k);
       if (i1 > 127)
         break label191;
       j = _appendByteEscape(i1, arrayOfInt[i1], localByteArrayBuilder, j);
       localObject1 = localByteArrayBuilder.getCurrentSegment();
       k = n;
     }
     else
     {
       if (j < localObject1.length)
         break label591;
       localObject1 = localByteArrayBuilder.finishCurrentSegment();
     }
   }
   label191: label584: label591: for (int i16 = 0; ; i16 = j)
   {
     j = i16 + 1;
     localObject1[i16] = ((byte)m);
     k++;
     if (k < i)
       break label51;
     return this._byteBuilder.completeAndCoalesce(j);
     int i4;
     Object localObject2;
     int i6;
     if (i1 <= 2047)
     {
       i4 = j + 1;
       localObject1[j] = ((byte)(0xC0 | i1 >> 6));
       int i15 = 0x80 | i1 & 0x3F;
       localObject2 = localObject1;
       i6 = i15;
       if (i4 >= localObject2.length)
       {
         localObject2 = localByteArrayBuilder.finishCurrentSegment();
         i4 = 0;
       }
       int i7 = i4 + 1;
       localObject2[i4] = ((byte)i6);
       localObject1 = localObject2;
       k = n;
       j = i7;
       break;
     }
     int i2;
     if ((i1 < 55296) || (i1 > 57343))
     {
       i2 = j + 1;
       localObject1[j] = ((byte)(0xE0 | i1 >> 12));
       if (i2 < localObject1.length)
         break label584;
       localObject1 = localByteArrayBuilder.finishCurrentSegment();
     }
     for (int i3 = 0; ; i3 = i2)
     {
       i4 = i3 + 1;
       localObject1[i3] = ((byte)(0x80 | 0x3F & i1 >> 6));
       int i5 = 0x80 | i1 & 0x3F;
       localObject2 = localObject1;
       i6 = i5;
       break;
       if (i1 > 56319)
         _illegalSurrogate(i1);
       if (n >= i)
         _illegalSurrogate(i1);
       int i8 = n + 1;
       int i9 = _convertSurrogate(i1, paramString.charAt(n));
       if (i9 > 1114111)
         _illegalSurrogate(i9);
       int i10 = j + 1;
       localObject1[j] = ((byte)(0xF0 | i9 >> 18));
       if (i10 >= localObject1.length)
         localObject1 = localByteArrayBuilder.finishCurrentSegment();
       for (int i11 = 0; ; i11 = i10)
       {
         int i12 = i11 + 1;
         localObject1[i11] = ((byte)(0x80 | 0x3F & i9 >> 12));
         if (i12 >= localObject1.length)
           localObject1 = localByteArrayBuilder.finishCurrentSegment();
         for (int i13 = 0; ; i13 = i12)
         {
           i4 = i13 + 1;
           localObject1[i13] = ((byte)(0x80 | 0x3F & i9 >> 6));
           int i14 = 0x80 | i9 & 0x3F;
           n = i8;
           Object localObject3 = localObject1;
           i6 = i14;
           localObject2 = localObject3;
           break;
         }
       }
     }
   }
 }