public int readLength()

in src/com/amazon/ion/impl/IonBinary.java [1059:1110]


        public int readLength(int td, int ln) throws IOException
        {
            // TODO check for invalid lownibbles
            switch (td) {
            case _Private_IonConstants.tidNull: // null(0)
            case _Private_IonConstants.tidBoolean: // boolean(1)
                return 0;
            case _Private_IonConstants.tidPosInt: // 2
            case _Private_IonConstants.tidNegInt: // 3
            case _Private_IonConstants.tidFloat: // float(4)
            case _Private_IonConstants.tidDecimal: // decimal(5)
            case _Private_IonConstants.tidTimestamp: // timestamp(6)
            case _Private_IonConstants.tidSymbol: // symbol(7)
            case _Private_IonConstants.tidString: // string (8)
            case _Private_IonConstants.tidClob: // clob(9)
            case _Private_IonConstants.tidBlob: // blob(10)
            case _Private_IonConstants.tidList:     // 11
            case _Private_IonConstants.tidSexp:     // 12
            case _Private_IonConstants.tidTypedecl: // 14
                switch (ln) {
                case 0:
                case _Private_IonConstants.lnIsNullAtom:
                    return 0;
                case _Private_IonConstants.lnIsVarLen:
                    return readVarUIntAsInt();
                default:
                    return ln;
                }
            case _Private_IonConstants.tidNopPad:   // 99
                switch (ln) {
                    case _Private_IonConstants.lnIsVarLen:
                        return readVarUIntAsInt();
                    default:
                        return ln;
                }
            case _Private_IonConstants.tidStruct: // 13
                switch (ln) {
                case _Private_IonConstants.lnIsEmptyContainer:
                case _Private_IonConstants.lnIsNullStruct:
                    return 0;
                case _Private_IonConstants.lnIsOrderedStruct:
                case _Private_IonConstants.lnIsVarLen:
                    return readVarUIntAsInt();
                default:
                    return ln;
                }
            case _Private_IonConstants.tidUnused: // unused(15)
            default:
                // TODO use InvalidBinaryDataException
                throw new BlockedBuffer.BlockedBufferException("invalid type id encountered: " + td);
            }
        }