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); } }
public final byte[] getBinaryValue(Base64Variant paramBase64Variant) { if ((this._currToken != JsonToken.VALUE_STRING) && ((this._currToken != JsonToken.VALUE_EMBEDDED_OBJECT) || (this._binaryValue == null))) _reportError("Current token (" + this._currToken + ") not VALUE_STRING or VALUE_EMBEDDED_OBJECT, can not access as binary"); if (this._tokenIncomplete); while (true) { try { this._binaryValue = _decodeBase64(paramBase64Variant); this._tokenIncomplete = false; return this._binaryValue; } catch (IllegalArgumentException localIllegalArgumentException) { throw _constructError("Failed to decode VALUE_STRING as base64 (" + paramBase64Variant + "): " + localIllegalArgumentException.getMessage()); } if (this._binaryValue == null) { ByteArrayBuilder localByteArrayBuilder = _getByteArrayBuilder(); _decodeBase64(getText(), localByteArrayBuilder, paramBase64Variant); this._binaryValue = localByteArrayBuilder.toByteArray(); } } }
public byte[] writeValueAsBytes(Object value, JsonSerialize.Inclusion inc) throws IOException, JsonGenerationException, JsonMappingException { if (inc == null) { return super.writeValueAsBytes(value); } // alas, we have to pull the recycler directly here... ByteArrayBuilder bb = new ByteArrayBuilder(_jsonFactory._getBufferRecycler()); writeValueWithConf(_jsonFactory.createJsonGenerator(bb, JsonEncoding.UTF8), value,inc); byte[] result = bb.toByteArray(); bb.release(); return result; }
public byte[] writeValueAsBytes(Object paramObject) throws IOException, JsonGenerationException, JsonMappingException { ByteArrayBuilder localByteArrayBuilder = new ByteArrayBuilder(this._jsonFactory._getBufferRecycler()); _configAndWriteValue(this._jsonFactory.createJsonGenerator(localByteArrayBuilder, JsonEncoding.UTF8), paramObject); byte[] arrayOfByte = localByteArrayBuilder.toByteArray(); localByteArrayBuilder.release(); return arrayOfByte; }
public ByteArrayBuilder _getByteArrayBuilder() { if (this._byteArrayBuilder == null) this._byteArrayBuilder = new ByteArrayBuilder(); while (true) { return this._byteArrayBuilder; this._byteArrayBuilder.reset(); } }
/** * 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. * * @since 1.5 */ public byte[] writeValueAsBytes(Object value) throws IOException, JsonGenerationException, JsonMappingException { ByteArrayBuilder bb = new ByteArrayBuilder(_jsonFactory._getBufferRecycler()); _configAndWriteValue(_jsonFactory.createJsonGenerator(bb, JsonEncoding.UTF8), value); byte[] result = bb.toByteArray(); bb.release(); return result; }
protected byte[] _decodeBase64(Base64Variant paramBase64Variant) throws IOException, JsonParseException { ByteArrayBuilder localByteArrayBuilder = _getByteArrayBuilder(); while (true) { if (this._inputPtr >= this._inputEnd) loadMoreGuaranteed(); char[] arrayOfChar1 = this._inputBuffer; int i = this._inputPtr; this._inputPtr = (i + 1); char c1 = arrayOfChar1[i]; if (c1 <= ' ') continue; int j = paramBase64Variant.decodeBase64Char(c1); if (j < 0) { if (c1 == '"') return localByteArrayBuilder.toByteArray(); j = _decodeBase64Escape(paramBase64Variant, c1, 0); if (j < 0) continue; } int k = j; if (this._inputPtr >= this._inputEnd) loadMoreGuaranteed(); char[] arrayOfChar2 = this._inputBuffer; int m = this._inputPtr; this._inputPtr = (m + 1); char c2 = arrayOfChar2[m]; int n = paramBase64Variant.decodeBase64Char(c2); if (n < 0) n = _decodeBase64Escape(paramBase64Variant, c2, 1); int i1 = n | k << 6; if (this._inputPtr >= this._inputEnd) loadMoreGuaranteed(); char[] arrayOfChar3 = this._inputBuffer; int i2 = this._inputPtr; this._inputPtr = (i2 + 1); char c3 = arrayOfChar3[i2]; int i3 = paramBase64Variant.decodeBase64Char(c3); if (i3 < 0) { if (i3 != -2) i3 = _decodeBase64Escape(paramBase64Variant, c3, 2); if (i3 == -2) { if (this._inputPtr >= this._inputEnd) loadMoreGuaranteed(); char[] arrayOfChar5 = this._inputBuffer; int i7 = this._inputPtr; this._inputPtr = (i7 + 1); char c5 = arrayOfChar5[i7]; if (!paramBase64Variant.usesPaddingChar(c5)) throw reportInvalidChar(paramBase64Variant, c5, 3, "expected padding character '" + paramBase64Variant.getPaddingChar() + "'"); localByteArrayBuilder.append(i1 >> 4); continue; } } int i4 = i3 | i1 << 6; if (this._inputPtr >= this._inputEnd) loadMoreGuaranteed(); char[] arrayOfChar4 = this._inputBuffer; int i5 = this._inputPtr; this._inputPtr = (i5 + 1); char c4 = arrayOfChar4[i5]; int i6 = paramBase64Variant.decodeBase64Char(c4); if (i6 < 0) { if (i6 != -2) i6 = _decodeBase64Escape(paramBase64Variant, c4, 3); if (i6 == -2) { localByteArrayBuilder.appendTwoBytes(i4 >> 2); continue; } } localByteArrayBuilder.appendThreeBytes(i6 | i4 << 6); } }
protected byte[] _decodeBase64(Base64Variant paramBase64Variant) throws IOException, JsonParseException { ByteArrayBuilder localByteArrayBuilder = _getByteArrayBuilder(); while (true) { if (this._inputPtr >= this._inputEnd) loadMoreGuaranteed(); byte[] arrayOfByte1 = this._inputBuffer; int i = this._inputPtr; this._inputPtr = (i + 1); int j = 0xFF & arrayOfByte1[i]; if (j <= 32) continue; int k = paramBase64Variant.decodeBase64Char(j); if (k < 0) { if (j == 34) return localByteArrayBuilder.toByteArray(); k = _decodeBase64Escape(paramBase64Variant, j, 0); if (k < 0) continue; } int m = k; if (this._inputPtr >= this._inputEnd) loadMoreGuaranteed(); byte[] arrayOfByte2 = this._inputBuffer; int n = this._inputPtr; this._inputPtr = (n + 1); int i1 = 0xFF & arrayOfByte2[n]; int i2 = paramBase64Variant.decodeBase64Char(i1); if (i2 < 0) i2 = _decodeBase64Escape(paramBase64Variant, i1, 1); int i3 = i2 | m << 6; if (this._inputPtr >= this._inputEnd) loadMoreGuaranteed(); byte[] arrayOfByte3 = this._inputBuffer; int i4 = this._inputPtr; this._inputPtr = (i4 + 1); int i5 = 0xFF & arrayOfByte3[i4]; int i6 = paramBase64Variant.decodeBase64Char(i5); if (i6 < 0) { if (i6 != -2) i6 = _decodeBase64Escape(paramBase64Variant, i5, 2); if (i6 == -2) { if (this._inputPtr >= this._inputEnd) loadMoreGuaranteed(); byte[] arrayOfByte5 = this._inputBuffer; int i11 = this._inputPtr; this._inputPtr = (i11 + 1); int i12 = 0xFF & arrayOfByte5[i11]; if (!paramBase64Variant.usesPaddingChar(i12)) throw reportInvalidChar(paramBase64Variant, i12, 3, "expected padding character '" + paramBase64Variant.getPaddingChar() + "'"); localByteArrayBuilder.append(i3 >> 4); continue; } } int i7 = i6 | i3 << 6; if (this._inputPtr >= this._inputEnd) loadMoreGuaranteed(); byte[] arrayOfByte4 = this._inputBuffer; int i8 = this._inputPtr; this._inputPtr = (i8 + 1); int i9 = 0xFF & arrayOfByte4[i8]; int i10 = paramBase64Variant.decodeBase64Char(i9); if (i10 < 0) { if (i10 != -2) i10 = _decodeBase64Escape(paramBase64Variant, i9, 3); if (i10 == -2) { localByteArrayBuilder.appendTwoBytes(i7 >> 2); continue; } } localByteArrayBuilder.appendThreeBytes(i10 | i7 << 6); } }
public byte[] getBinaryValue(Base64Variant paramBase64Variant) throws IOException { ByteArrayBuilder localByteArrayBuilder = new ByteArrayBuilder(100); String str = this._value; int i = 0; int j = str.length(); if (i < j); while (true) { int k = i + 1; char c1 = str.charAt(i); if (k >= j) return localByteArrayBuilder.toByteArray(); if (c1 > ' ') { int m = paramBase64Variant.decodeBase64Char(c1); if (m < 0) _reportInvalidBase64(paramBase64Variant, c1, 0); if (k >= j) _reportBase64EOF(); int n = k + 1; char c2 = str.charAt(k); int i1 = paramBase64Variant.decodeBase64Char(c2); if (i1 < 0) _reportInvalidBase64(paramBase64Variant, c2, 1); int i2 = i1 | m << 6; if (n >= j) _reportBase64EOF(); int i3 = n + 1; char c3 = str.charAt(n); int i4 = paramBase64Variant.decodeBase64Char(c3); if (i4 < 0) { if (i4 != -2) _reportInvalidBase64(paramBase64Variant, c3, 2); if (i3 >= j) _reportBase64EOF(); i = i3 + 1; char c5 = str.charAt(i3); if (!paramBase64Variant.usesPaddingChar(c5)) _reportInvalidBase64(paramBase64Variant, c5, 3, "expected padding character '" + paramBase64Variant.getPaddingChar() + "'"); localByteArrayBuilder.append(i2 >> 4); break; } int i5 = i4 | i2 << 6; if (i3 >= j) _reportBase64EOF(); i = i3 + 1; char c4 = str.charAt(i3); int i6 = paramBase64Variant.decodeBase64Char(c4); if (i6 < 0) { if (i6 != -2) _reportInvalidBase64(paramBase64Variant, c4, 3); localByteArrayBuilder.appendTwoBytes(i5 >> 2); break; } localByteArrayBuilder.appendThreeBytes(i6 | i5 << 6); break; } i = k; } }
protected void _decodeBase64(String paramString, ByteArrayBuilder paramByteArrayBuilder, Base64Variant paramBase64Variant) { int i = paramString.length(); int j = 0; if (j < i); while (true) { int k = j + 1; char c1 = paramString.charAt(j); int n; int i2; if (k < i) { if (c1 <= ' ') break label376; int m = paramBase64Variant.decodeBase64Char(c1); if (m < 0) _reportInvalidBase64(paramBase64Variant, c1, 0, null); if (k >= i) _reportBase64EOF(); n = k + 1; char c2 = paramString.charAt(k); int i1 = paramBase64Variant.decodeBase64Char(c2); if (i1 < 0) _reportInvalidBase64(paramBase64Variant, c2, 1, null); i2 = i1 | m << 6; if (n < i) break label150; if (!paramBase64Variant.usesPadding()) paramByteArrayBuilder.append(i2 >> 4); } else { return; } _reportBase64EOF(); label150: int i3 = n + 1; char c3 = paramString.charAt(n); int i4 = paramBase64Variant.decodeBase64Char(c3); if (i4 < 0) { if (i4 != -2) _reportInvalidBase64(paramBase64Variant, c3, 2, null); if (i3 >= i) _reportBase64EOF(); j = i3 + 1; char c5 = paramString.charAt(i3); if (!paramBase64Variant.usesPaddingChar(c5)) _reportInvalidBase64(paramBase64Variant, c5, 3, "expected padding character '" + paramBase64Variant.getPaddingChar() + "'"); paramByteArrayBuilder.append(i2 >> 4); break; } int i5 = i4 | i2 << 6; if (i3 >= i) { if (!paramBase64Variant.usesPadding()) { paramByteArrayBuilder.appendTwoBytes(i5 >> 2); return; } _reportBase64EOF(); } j = i3 + 1; char c4 = paramString.charAt(i3); int i6 = paramBase64Variant.decodeBase64Char(c4); if (i6 < 0) { if (i6 != -2) _reportInvalidBase64(paramBase64Variant, c4, 3, null); paramByteArrayBuilder.appendTwoBytes(i5 >> 2); break; } paramByteArrayBuilder.appendThreeBytes(i6 | i5 << 6); break; label376: j = k; } }