// Decompiled by Jad v1.5.8e. Copyright 2001 Pavel Kouznetsov. // Jad home page: http://www.geocities.com/kpdus/jad.html // Decompiler options: braces fieldsfirst space lnc package com.fasterxml.jackson.core.base; import com.fasterxml.jackson.core.Base64Variant; import com.fasterxml.jackson.core.JsonParseException; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.JsonStreamContext; import com.fasterxml.jackson.core.JsonToken; import com.fasterxml.jackson.core.io.NumberInput; import com.fasterxml.jackson.core.util.ByteArrayBuilder; import com.fasterxml.jackson.core.util.VersionUtil; import java.io.IOException; public abstract class ParserMinimalBase extends JsonParser { protected static final int INT_BACKSLASH = 92; protected static final int INT_COLON = 58; protected static final int INT_COMMA = 44; protected static final int INT_CR = 13; protected static final int INT_E = 69; protected static final int INT_HASH = 35; protected static final int INT_LBRACKET = 91; protected static final int INT_LCURLY = 123; protected static final int INT_LF = 10; protected static final int INT_PERIOD = 46; protected static final int INT_QUOTE = 34; protected static final int INT_RBRACKET = 93; protected static final int INT_RCURLY = 125; protected static final int INT_SLASH = 47; protected static final int INT_SPACE = 32; protected static final int INT_TAB = 9; protected static final int INT_e = 101; protected JsonToken _currToken; protected JsonToken _lastClearedToken; protected ParserMinimalBase() { } protected ParserMinimalBase(int i) { super(i); } protected static String _ascii(byte abyte0[]) { try { abyte0 = new String(abyte0, "US-ASCII"); } // Misplaced declaration of an exception variable catch (byte abyte0[]) { throw new RuntimeException(abyte0); } return abyte0; } protected static byte[] _asciiBytes(String s) { byte abyte0[] = new byte[s.length()]; int i = 0; for (int j = s.length(); i < j; i++) { abyte0[i] = (byte)s.charAt(i); } return abyte0; } protected static final String _getCharDesc(int i) { char c = (char)i; if (Character.isISOControl(c)) { return (new StringBuilder()).append("(CTRL-CHAR, code ").append(i).append(")").toString(); } if (i > 255) { return (new StringBuilder()).append("'").append(c).append("' (code ").append(i).append(" / 0x").append(Integer.toHexString(i)).append(")").toString(); } else { return (new StringBuilder()).append("'").append(c).append("' (code ").append(i).append(")").toString(); } } protected final JsonParseException _constructError(String s, Throwable throwable) { return new JsonParseException(s, getCurrentLocation(), throwable); } protected void _decodeBase64(String s, ByteArrayBuilder bytearraybuilder, Base64Variant base64variant) throws IOException { try { base64variant.decode(s, bytearraybuilder); return; } // Misplaced declaration of an exception variable catch (String s) { _reportError(s.getMessage()); } } protected abstract void _handleEOF() throws JsonParseException; protected char _handleUnrecognizedCharacterEscape(char c) throws JsonProcessingException { while (isEnabled(com.fasterxml.jackson.core.JsonParser.Feature.ALLOW_BACKSLASH_ESCAPING_ANY_CHARACTER) || c == '\'' && isEnabled(com.fasterxml.jackson.core.JsonParser.Feature.ALLOW_SINGLE_QUOTES)) { return c; } _reportError((new StringBuilder()).append("Unrecognized character escape ").append(_getCharDesc(c)).toString()); return c; } protected boolean _hasTextualNull(String s) { return "null".equals(s); } protected final void _reportError(String s) throws JsonParseException { throw _constructError(s); } protected void _reportInvalidEOF() throws JsonParseException { _reportInvalidEOF((new StringBuilder()).append(" in ").append(_currToken).toString()); } protected void _reportInvalidEOF(String s) throws JsonParseException { _reportError((new StringBuilder()).append("Unexpected end-of-input").append(s).toString()); } protected void _reportInvalidEOFInValue() throws JsonParseException { _reportInvalidEOF(" in a value"); } protected void _reportMissingRootWS(int i) throws JsonParseException { _reportUnexpectedChar(i, "Expected space separating root-level values"); } protected void _reportUnexpectedChar(int i, String s) throws JsonParseException { if (i < 0) { _reportInvalidEOF(); } String s2 = (new StringBuilder()).append("Unexpected character (").append(_getCharDesc(i)).append(")").toString(); String s1 = s2; if (s != null) { s1 = (new StringBuilder()).append(s2).append(": ").append(s).toString(); } _reportError(s1); } protected final void _throwInternal() { VersionUtil.throwInternal(); } protected void _throwInvalidSpace(int i) throws JsonParseException { i = (char)i; _reportError((new StringBuilder()).append("Illegal character (").append(_getCharDesc(i)).append("): only regular white space (\\r, \\n, \\t) is allowed between tokens").toString()); } protected void _throwUnquotedSpace(int i, String s) throws JsonParseException { if (!isEnabled(com.fasterxml.jackson.core.JsonParser.Feature.ALLOW_UNQUOTED_CONTROL_CHARS) || i > 32) { i = (char)i; _reportError((new StringBuilder()).append("Illegal unquoted character (").append(_getCharDesc(i)).append("): has to be escaped using backslash to be included in ").append(s).toString()); } } protected final void _wrapError(String s, Throwable throwable) throws JsonParseException { throw _constructError(s, throwable); } public void clearCurrentToken() { if (_currToken != null) { _lastClearedToken = _currToken; _currToken = null; } } public abstract void close() throws IOException; public abstract byte[] getBinaryValue(Base64Variant base64variant) throws IOException; public abstract String getCurrentName() throws IOException; public JsonToken getCurrentToken() { return _currToken; } public int getCurrentTokenId() { JsonToken jsontoken = _currToken; if (jsontoken == null) { return 0; } else { return jsontoken.id(); } } public JsonToken getLastClearedToken() { return _lastClearedToken; } public abstract JsonStreamContext getParsingContext(); public abstract String getText() throws IOException; public abstract char[] getTextCharacters() throws IOException; public abstract int getTextLength() throws IOException; public abstract int getTextOffset() throws IOException; public boolean getValueAsBoolean(boolean flag) throws IOException { Object obj; boolean flag2; flag2 = true; obj = _currToken; if (obj == null) goto _L2; else goto _L1 _L1: boolean flag1 = flag2; ((JsonToken) (obj)).id(); JVM INSTR tableswitch 6 12: default 60 // 6 64 // 7 107 // 8 60 // 9 62 // 10 119 // 11 119 // 12 121; goto _L2 _L3 _L4 _L2 _L5 _L6 _L6 _L7 _L2: flag1 = flag; _L5: return flag1; _L3: obj = getText().trim(); flag1 = flag2; if ("true".equals(obj)) goto _L5; else goto _L8 _L8: if ("false".equals(obj)) { return false; } if (_hasTextualNull(((String) (obj)))) { return false; } continue; /* Loop/switch isn't completed */ _L4: flag1 = flag2; if (getIntValue() != 0) goto _L5; else goto _L9 _L9: return false; _L6: return false; _L7: Object obj1 = getEmbeddedObject(); if (obj1 instanceof Boolean) { return ((Boolean)obj1).booleanValue(); } if (true) goto _L2; else goto _L10 _L10: } public double getValueAsDouble(double d) throws IOException { JsonToken jsontoken = _currToken; if (jsontoken == null) goto _L2; else goto _L1 _L1: jsontoken.id(); JVM INSTR tableswitch 6 12: default 56 // 6 58 // 7 79 // 8 79 // 9 84 // 10 86 // 11 86 // 12 88; goto _L2 _L3 _L4 _L4 _L5 _L6 _L6 _L7 _L2: return d; _L3: String s = getText(); if (_hasTextualNull(s)) { return 0.0D; } else { return NumberInput.parseAsDouble(s, d); } _L4: return getDoubleValue(); _L5: return 1.0D; _L6: return 0.0D; _L7: Object obj = getEmbeddedObject(); if (obj instanceof Number) { return ((Number)obj).doubleValue(); } if (true) goto _L2; else goto _L8 _L8: } public int getValueAsInt() throws IOException { JsonToken jsontoken = _currToken; if (jsontoken == JsonToken.VALUE_NUMBER_INT) { return getIntValue(); } if (jsontoken == JsonToken.VALUE_NUMBER_FLOAT) { return getIntValue(); } else { return getValueAsInt(0); } } public int getValueAsInt(int i) throws IOException { Object obj = _currToken; int j; if (obj == JsonToken.VALUE_NUMBER_INT) { j = getIntValue(); } else { if (obj == JsonToken.VALUE_NUMBER_FLOAT) { return getIntValue(); } j = i; if (obj != null) { switch (((JsonToken) (obj)).id()) { case 7: // '\007' case 8: // '\b' default: return i; case 6: // '\006' obj = getText(); if (_hasTextualNull(((String) (obj)))) { return 0; } else { return NumberInput.parseAsInt(((String) (obj)), i); } case 9: // '\t' return 1; case 10: // '\n' return 0; case 11: // '\013' return 0; case 12: // '\f' obj = getEmbeddedObject(); j = i; break; } if (obj instanceof Number) { return ((Number)obj).intValue(); } } } return j; } public long getValueAsLong() throws IOException { JsonToken jsontoken = _currToken; if (jsontoken == JsonToken.VALUE_NUMBER_INT) { return getLongValue(); } if (jsontoken == JsonToken.VALUE_NUMBER_FLOAT) { return getLongValue(); } else { return getValueAsLong(0L); } } public long getValueAsLong(long l) throws IOException { Object obj = _currToken; long l1; if (obj == JsonToken.VALUE_NUMBER_INT) { l1 = getLongValue(); } else { if (obj == JsonToken.VALUE_NUMBER_FLOAT) { return getLongValue(); } l1 = l; if (obj != null) { switch (((JsonToken) (obj)).id()) { case 7: // '\007' case 8: // '\b' default: return l; case 6: // '\006' obj = getText(); if (_hasTextualNull(((String) (obj)))) { return 0L; } else { return NumberInput.parseAsLong(((String) (obj)), l); } case 9: // '\t' return 1L; case 10: // '\n' case 11: // '\013' return 0L; case 12: // '\f' obj = getEmbeddedObject(); l1 = l; break; } if (obj instanceof Number) { return ((Number)obj).longValue(); } } } return l1; } public String getValueAsString() throws IOException { if (_currToken == JsonToken.VALUE_STRING) { return getText(); } if (_currToken == JsonToken.FIELD_NAME) { return getCurrentName(); } else { return getValueAsString(null); } } public String getValueAsString(String s) throws IOException { String s1; if (_currToken == JsonToken.VALUE_STRING) { s1 = getText(); } else { if (_currToken == JsonToken.FIELD_NAME) { return getCurrentName(); } s1 = s; if (_currToken != null) { s1 = s; if (_currToken != JsonToken.VALUE_NULL) { s1 = s; if (_currToken.isScalarValue()) { return getText(); } } } } return s1; } public boolean hasCurrentToken() { return _currToken != null; } public abstract boolean hasTextCharacters(); public boolean hasToken(JsonToken jsontoken) { return _currToken == jsontoken; } public boolean hasTokenId(int i) { JsonToken jsontoken = _currToken; if (jsontoken != null) goto _L2; else goto _L1 _L1: if (i != 0) goto _L4; else goto _L3 _L3: return true; _L4: return false; _L2: if (jsontoken.id() != i) { return false; } if (true) goto _L3; else goto _L5 _L5: } public abstract boolean isClosed(); public boolean isExpectedStartArrayToken() { return _currToken == JsonToken.START_ARRAY; } public boolean isExpectedStartObjectToken() { return _currToken == JsonToken.START_OBJECT; } public abstract JsonToken nextToken() throws IOException; public JsonToken nextValue() throws IOException { JsonToken jsontoken1 = nextToken(); JsonToken jsontoken = jsontoken1; if (jsontoken1 == JsonToken.FIELD_NAME) { jsontoken = nextToken(); } return jsontoken; } public abstract void overrideCurrentName(String s); public JsonParser skipChildren() throws IOException { if (_currToken != JsonToken.START_OBJECT && _currToken != JsonToken.START_ARRAY) { return this; } int i = 1; int j; do { JsonToken jsontoken; do { do { jsontoken = nextToken(); if (jsontoken == null) { _handleEOF(); return this; } if (!jsontoken.isStructStart()) { break; } i++; } while (true); } while (!jsontoken.isStructEnd()); j = i - 1; i = j; } while (j != 0); return this; } }