code: private TypeID genericReadTypeID(RecordInput rin, String tag) throws IOException {
      byte typeVal = rin.readByte(tag);
      switch (typeVal) {
      case TypeID.RIOType.BOOL: 
        return TypeID.BoolTypeID;
      case TypeID.RIOType.BUFFER: 
        return TypeID.BufferTypeID;
      case TypeID.RIOType.BYTE:
        return TypeID.ByteTypeID;
      case TypeID.RIOType.DOUBLE:
        return TypeID.DoubleTypeID;
      case TypeID.RIOType.FLOAT:
        return TypeID.FloatTypeID;
      case TypeID.RIOType.INT: 
        return TypeID.IntTypeID;
      case TypeID.RIOType.LONG:
        return TypeID.LongTypeID;
      case TypeID.RIOType.MAP:
      {
        TypeID tIDKey = genericReadTypeID(rin, tag);
        TypeID tIDValue = genericReadTypeID(rin, tag);
        return new MapTypeID(tIDKey, tIDValue);
      }
      case TypeID.RIOType.STRING: 
        return TypeID.StringTypeID;
      case TypeID.RIOType.STRUCT: 
      {
        StructTypeID stID = new StructTypeID();
        int numElems = rin.readInt(tag);
        for (int i=0; i<numElems; i++) {
          stID.add(genericReadTypeInfo(rin, tag));
        }
        return stID;
      }
      case TypeID.RIOType.VECTOR: 
      {
        TypeID tID = genericReadTypeID(rin, tag);
        return new VectorTypeID(tID);
      }
      default:
        // shouldn't be here
        throw new IOException("Unknown type read");
      }
    }
docs: generic reader: reads the next TypeID object from stream and returns it