public Type setNullType()

in src/com/amazon/ion/impl/IonTokenReader.java [764:913]


    public Type setNullType(StringBuilder sb, int pos, int valuelen)
    {
        switch (valuelen) {
        case 3:
            //int
            if (sb.charAt(pos++) == 'i'
             && sb.charAt(pos++) == 'n'
             && sb.charAt(pos++) == 't'
            ) {
                return Type.kwNullInt;
            }
            break;
        case 4:
            //bool, blob, list, null, clob, sexp
            switch (sb.charAt(pos++)) {
            case 'b':
                //bool, blob
                switch (sb.charAt(pos++)) {
                    case 'o':
                        // bool
                        if (sb.charAt(pos++) == 'o'
                         && sb.charAt(pos++) == 'l'
                        ) {
                            return Type.kwNullBoolean;
                        }
                        break;
                    case 'l':
                        //blob
                        if (sb.charAt(pos++) == 'o'
                         && sb.charAt(pos++) == 'b'
                        ) {
                            return Type.kwNullBlob;
                        }
                        break;
                }
                break;
            case 'l':
                if (sb.charAt(pos++) == 'i'
                 && sb.charAt(pos++) == 's'
                 && sb.charAt(pos++) == 't'
                ) {
                    return Type.kwNullList;
                }
                break;
            case 'n':
                if (sb.charAt(pos++) == 'u'
                 && sb.charAt(pos++) == 'l'
                 && sb.charAt(pos++) == 'l'
                ) {
                    return Type.kwNullNull;
                }
                break;
            case 'c':
                //clob
                if (sb.charAt(pos++) == 'l'
                 && sb.charAt(pos++) == 'o'
                 && sb.charAt(pos++) == 'b'
                ) {
                    return Type.kwNullClob;
                }
                break;
            case 's':
                //sexp
                if (sb.charAt(pos++) == 'e'
                 && sb.charAt(pos++) == 'x'
                 && sb.charAt(pos++) == 'p'
                ) {
                    return Type.kwNullSexp;
                }
                break;
            }
            break;
        case 5:
            //float
            if (sb.charAt(pos++) == 'f'
             && sb.charAt(pos++) == 'l'
             && sb.charAt(pos++) == 'o'
             && sb.charAt(pos++) == 'a'
             && sb.charAt(pos++) == 't'
            ) {
                return Type.kwNullFloat;
            }
            break;
        case 6:
            switch (sb.charAt(pos++)) {
            case 's':
                //string
                //struct
                //symbol
                switch(sb.charAt(pos++)) {
                case 't':
                    if (sb.charAt(pos++) == 'r') {
                        switch (sb.charAt(pos++)) {
                        case 'i':
                            if (sb.charAt(pos++) == 'n' && sb.charAt(pos++) == 'g') {
                                return Type.kwNullString;
                            }
                            break;
                        case 'u':
                            if (sb.charAt(pos++) == 'c' && sb.charAt(pos++) == 't') {
                                return Type.kwNullStruct;
                            }
                            break;
                        }
                    }
                    break;
                case 'y':
                    if (sb.charAt(pos++) == 'm'
                     && sb.charAt(pos++) == 'b'
                     && sb.charAt(pos++) == 'o'
                     && sb.charAt(pos++) == 'l'
                    ) {
                        return Type.kwNullSymbol;
                    }
                    break;
                }
            }
            break;
        case 7:
            //decimal
            if (sb.charAt(pos++) == 'd'
             && sb.charAt(pos++) == 'e'
             && sb.charAt(pos++) == 'c'
             && sb.charAt(pos++) == 'i'
             && sb.charAt(pos++) == 'm'
             && sb.charAt(pos++) == 'a'
             && sb.charAt(pos++) == 'l'
            ) {
                return Type.kwNullDecimal;
            }
            break;
        case 9:
            //timestamp
            if (sb.charAt(pos++) == 't'
             && sb.charAt(pos++) == 'i'
             && sb.charAt(pos++) == 'm'
             && sb.charAt(pos++) == 'e'
             && sb.charAt(pos++) == 's'
             && sb.charAt(pos++) == 't'
             && sb.charAt(pos++) == 'a'
             && sb.charAt(pos++) == 'm'
             && sb.charAt(pos++) == 'p'
            ) {
                return Type.kwNullTimestamp;
            }
            break;
        }
        String nullimage = sb.toString();
        throw new IonException("invalid null value '"+nullimage+"' at " + this.position());
    }