protected void _reportInvalidBase64(Base64Variant paramBase64Variant, char paramChar, int paramInt, String paramString) throws JsonParseException { String str; if (paramChar <= ' ') str = "Illegal white space character (code 0x" + Integer.toHexString(paramChar) + ") as character #" + (paramInt + 1) + " of 4-char base64 unit: can only used between units"; while (true) { if (paramString != null) str = str + ": " + paramString; throw _constructError(str); if (paramBase64Variant.usesPaddingChar(paramChar)) { str = "Unexpected padding character ('" + paramBase64Variant.getPaddingChar() + "') as character #" + (paramInt + 1) + " of 4-char base64 unit: padding only legal as 3rd or 4th character"; continue; } if ((!Character.isDefined(paramChar)) || (Character.isISOControl(paramChar))) { str = "Illegal character (code 0x" + Integer.toHexString(paramChar) + ") in base64 content"; continue; } str = "Illegal character '" + paramChar + "' (code 0x" + Integer.toHexString(paramChar) + ") in base64 content"; } }
public byte[] getBinaryValue(Base64Variant paramBase64Variant) throws IOException, JsonParseException { if (this._currToken == JsonToken.VALUE_EMBEDDED_OBJECT) { Object localObject = _currentObject(); if ((localObject instanceof byte[])) return (byte[])(byte[])localObject; } if (this._currToken != JsonToken.VALUE_STRING) throw _constructError("Current token (" + this._currToken + ") not VALUE_STRING (or VALUE_EMBEDDED_OBJECT with byte[]), can not access as binary"); String str = getText(); if (str == null) return null; ByteArrayBuilder localByteArrayBuilder = this._byteBuilder; if (localByteArrayBuilder == null) { localByteArrayBuilder = new ByteArrayBuilder(100); this._byteBuilder = localByteArrayBuilder; } _decodeBase64(str, localByteArrayBuilder, paramBase64Variant); return localByteArrayBuilder.toByteArray(); }
private final int _decodeBase64Escape(Base64Variant paramBase64Variant, char paramChar, int paramInt) throws IOException, JsonParseException { if (paramChar != '\\') throw reportInvalidChar(paramBase64Variant, paramChar, paramInt); char c = _decodeEscaped(); int i; if ((c <= ' ') && (paramInt == 0)) i = -1; do { return i; i = paramBase64Variant.decodeBase64Char(c); } while (i >= 0); throw reportInvalidChar(paramBase64Variant, c, paramInt); }
public byte[] getBinaryValue(Base64Variant paramBase64Variant) throws IOException, JsonParseException { 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); 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()); }
protected IllegalArgumentException reportInvalidChar(Base64Variant paramBase64Variant, char paramChar, int paramInt, String paramString) throws IllegalArgumentException { String str; if (paramChar <= ' ') str = "Illegal white space character (code 0x" + Integer.toHexString(paramChar) + ") as character #" + (paramInt + 1) + " of 4-char base64 unit: can only used between units"; while (true) { if (paramString != null) str = str + ": " + paramString; return new IllegalArgumentException(str); if (paramBase64Variant.usesPaddingChar(paramChar)) { str = "Unexpected padding character ('" + paramBase64Variant.getPaddingChar() + "') as character #" + (paramInt + 1) + " of 4-char base64 unit: padding only legal as 3rd or 4th character"; continue; } if ((!Character.isDefined(paramChar)) || (Character.isISOControl(paramChar))) { str = "Illegal character (code 0x" + Integer.toHexString(paramChar) + ") in base64 content"; continue; } str = "Illegal character '" + paramChar + "' (code 0x" + Integer.toHexString(paramChar) + ") in base64 content"; } }
private final int _decodeBase64Escape(Base64Variant paramBase64Variant, int paramInt1, int paramInt2) throws IOException, JsonParseException { if (paramInt1 != 92) throw reportInvalidChar(paramBase64Variant, paramInt1, paramInt2); int i = _decodeEscaped(); int j; if ((i <= 32) && (paramInt2 == 0)) j = -1; do { return j; j = paramBase64Variant.decodeBase64Char(i); } while (j >= 0); throw reportInvalidChar(paramBase64Variant, i, paramInt2); }
protected IllegalArgumentException reportInvalidChar(Base64Variant paramBase64Variant, int paramInt1, int paramInt2, String paramString) throws IllegalArgumentException { String str; if (paramInt1 <= 32) str = "Illegal white space character (code 0x" + Integer.toHexString(paramInt1) + ") as character #" + (paramInt2 + 1) + " of 4-char base64 unit: can only used between units"; while (true) { if (paramString != null) str = str + ": " + paramString; return new IllegalArgumentException(str); if (paramBase64Variant.usesPaddingChar(paramInt1)) { str = "Unexpected padding character ('" + paramBase64Variant.getPaddingChar() + "') as character #" + (paramInt2 + 1) + " of 4-char base64 unit: padding only legal as 3rd or 4th character"; continue; } if ((!Character.isDefined(paramInt1)) || (Character.isISOControl(paramInt1))) { str = "Illegal character (code 0x" + Integer.toHexString(paramInt1) + ") in base64 content"; continue; } str = "Illegal character '" + (char)paramInt1 + "' (code 0x" + Integer.toHexString(paramInt1) + ") in base64 content"; } }
public void writeBinary(Base64Variant paramBase64Variant, byte[] paramArrayOfByte, int paramInt1, int paramInt2) throws IOException, JsonGenerationException { _verifyValueWrite("write binary value"); if (this._outputTail >= this._outputEnd) _flushBuffer(); char[] arrayOfChar1 = this._outputBuffer; int i = this._outputTail; this._outputTail = (i + 1); arrayOfChar1[i] = '"'; _writeBinary(paramBase64Variant, paramArrayOfByte, paramInt1, paramInt1 + paramInt2); if (this._outputTail >= this._outputEnd) _flushBuffer(); char[] arrayOfChar2 = this._outputBuffer; int j = this._outputTail; this._outputTail = (j + 1); arrayOfChar2[j] = '"'; }
public void writeBinary(Base64Variant paramBase64Variant, byte[] paramArrayOfByte, int paramInt1, int paramInt2) throws IOException, JsonGenerationException { _verifyValueWrite("write binary value"); if (this._outputTail >= this._outputEnd) _flushBuffer(); byte[] arrayOfByte1 = this._outputBuffer; int i = this._outputTail; this._outputTail = (i + 1); arrayOfByte1[i] = 34; _writeBinary(paramBase64Variant, paramArrayOfByte, paramInt1, paramInt1 + paramInt2); if (this._outputTail >= this._outputEnd) _flushBuffer(); byte[] arrayOfByte2 = this._outputBuffer; int j = this._outputTail; this._outputTail = (j + 1); arrayOfByte2[j] = 34; }
public byte[] getBinaryValue(Base64Variant paramBase64Variant) throws IOException, JsonParseException { JsonNode localJsonNode = currentNode(); if (localJsonNode != null) { byte[] arrayOfByte = localJsonNode.getBinaryValue(); if (arrayOfByte != null) return arrayOfByte; if (localJsonNode.isPojo()) { Object localObject = ((POJONode)localJsonNode).getPojo(); if ((localObject instanceof byte[])) return (byte[])(byte[])localObject; } } return null; }
protected void _reportInvalidBase64(Base64Variant paramBase64Variant, char paramChar, int paramInt, String paramString) throws JsonParseException { String str; if (paramChar <= ' ') str = "Illegal white space character (code 0x" + Integer.toHexString(paramChar) + ") as character #" + (paramInt + 1) + " of 4-char base64 unit: can only used between units"; while (true) { if (paramString != null) str = str + ": " + paramString; throw new JsonParseException(str, JsonLocation.NA); if (paramBase64Variant.usesPaddingChar(paramChar)) { str = "Unexpected padding character ('" + paramBase64Variant.getPaddingChar() + "') as character #" + (paramInt + 1) + " of 4-char base64 unit: padding only legal as 3rd or 4th character"; continue; } if ((!Character.isDefined(paramChar)) || (Character.isISOControl(paramChar))) { str = "Illegal character (code 0x" + Integer.toHexString(paramChar) + ") in base64 content"; continue; } str = "Illegal character '" + paramChar + "' (code 0x" + Integer.toHexString(paramChar) + ") in base64 content"; } }
public final byte[] getBinaryValue(Base64Variant paramBase64Variant) { if (this._currToken == JsonToken.VALUE_EMBEDDED_OBJECT) { Object localObject = _currentObject(); if ((localObject instanceof byte[])) return (byte[])localObject; } if (this._currToken != JsonToken.VALUE_STRING) throw _constructError("Current token (" + this._currToken + ") not VALUE_STRING (or VALUE_EMBEDDED_OBJECT with byte[]), can not access as binary"); String str = getText(); if (str == null) return null; ByteArrayBuilder localByteArrayBuilder = this._byteBuilder; if (localByteArrayBuilder == null) { localByteArrayBuilder = new ByteArrayBuilder(100); this._byteBuilder = localByteArrayBuilder; } _decodeBase64(str, localByteArrayBuilder, paramBase64Variant); return localByteArrayBuilder.toByteArray(); }
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 final void writeBinary(Base64Variant paramBase64Variant, byte[] paramArrayOfByte, int paramInt1, int paramInt2) { _verifyValueWrite("write binary value"); if (this._outputTail >= this._outputEnd) _flushBuffer(); char[] arrayOfChar1 = this._outputBuffer; int i = this._outputTail; this._outputTail = (i + 1); arrayOfChar1[i] = '"'; _writeBinary(paramBase64Variant, paramArrayOfByte, paramInt1, paramInt1 + paramInt2); if (this._outputTail >= this._outputEnd) _flushBuffer(); char[] arrayOfChar2 = this._outputBuffer; int j = this._outputTail; this._outputTail = (j + 1); arrayOfChar2[j] = '"'; }
protected void _reportInvalidBase64(Base64Variant paramBase64Variant, char paramChar, int paramInt, String paramString) { String str; if (paramChar <= ' ') str = "Illegal white space character (code 0x" + Integer.toHexString(paramChar) + ") as character #" + (paramInt + 1) + " of 4-char base64 unit: can only used between units"; while (true) { if (paramString != null) str = str + ": " + paramString; throw _constructError(str); if (paramBase64Variant.usesPaddingChar(paramChar)) str = "Unexpected padding character ('" + paramBase64Variant.getPaddingChar() + "') as character #" + (paramInt + 1) + " of 4-char base64 unit: padding only legal as 3rd or 4th character"; else if ((!Character.isDefined(paramChar)) || (Character.isISOControl(paramChar))) str = "Illegal character (code 0x" + Integer.toHexString(paramChar) + ") in base64 content"; else str = "Illegal character '" + paramChar + "' (code 0x" + Integer.toHexString(paramChar) + ") in base64 content"; } }
public void writeBinary(Base64Variant paramBase64Variant, byte[] paramArrayOfByte, int paramInt1, int paramInt2) throws IOException, JsonGenerationException { byte[] arrayOfByte = new byte[paramInt2]; System.arraycopy(paramArrayOfByte, paramInt1, arrayOfByte, 0, paramInt2); writeObject(arrayOfByte); }
public Base64Variant getBase64Variant() { return Base64Variants.getDefaultVariant(); }
public Base64Variant getBase64Variant() { return this._config.getBase64Variant(); }
public void writeBinary(Base64Variant paramBase64Variant, byte[] paramArrayOfByte, int paramInt1, int paramInt2) throws IOException, JsonGenerationException { this.delegate.writeBinary(paramBase64Variant, paramArrayOfByte, paramInt1, paramInt2); }
protected void _decodeBase64(String paramString, ByteArrayBuilder paramByteArrayBuilder, Base64Variant paramBase64Variant) throws IOException, JsonParseException { int i = 0; int j = paramString.length(); if (i < j); while (true) { int k = i + 1; char c1 = paramString.charAt(i); if (k >= j) return; if (c1 > ' ') { int m = paramBase64Variant.decodeBase64Char(c1); if (m < 0) _reportInvalidBase64(paramBase64Variant, c1, 0, null); if (k >= j) _reportBase64EOF(); int n = k + 1; char c2 = paramString.charAt(k); int i1 = paramBase64Variant.decodeBase64Char(c2); if (i1 < 0) _reportInvalidBase64(paramBase64Variant, c2, 1, null); int i2 = i1 | m << 6; if (n >= j) _reportBase64EOF(); 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 >= j) _reportBase64EOF(); i = 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 >= j) _reportBase64EOF(); i = 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; } i = k; } }
public byte[] getBinaryValue(Base64Variant paramBase64Variant) throws IOException, JsonParseException { return this.delegate.getBinaryValue(paramBase64Variant); }
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 IllegalArgumentException reportInvalidChar(Base64Variant paramBase64Variant, char paramChar, int paramInt) throws IllegalArgumentException { return reportInvalidChar(paramBase64Variant, paramChar, paramInt, null); }
protected abstract byte[] _decodeBase64(Base64Variant paramBase64Variant) throws IOException, JsonParseException;
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); } }