public Object[] match(String fmt) {
      List<Object> rv = new ArrayList<Object>();
      msg_off = 0;
      int len = fmt.length();
      int a = 0;
      try {
         while (a<len) {
            char ch = fmt.charAt(a++);
            if (ch != '%') {
               if (ch != get())
                  return null;
            } else {
               ch = fmt.charAt(a++);
               switch (ch) {
               case 'i':
                  rv.add(new Integer(get_int())); break;
               case 's':
                  rv.add(get_str()); break;
               case 'r':
                  rv.add(get_data()); break;
               case 't':
                  rv.add(get_tail()); break;
               default:
                  return null;
               }
            }
         }
      } catch (EOFException e) {
         return null;
      }
      if (msg_off != msg.length)
         return null;
      return rv.toArray(new Object[0]);
   }