private static boolean hasScheme(String str) {
    int len = str.length();
    if (len == 0)
      return false;
    if (!isAlpha(str.charAt(0)))
      return false;
    for (int i = 1; i < len; i++) {
      char c = str.charAt(i);
      switch (c) {
      case ':':
	// Don't recognize single letters as schemes
	return i == 1 ? false : true;
      case '+':
      case '-':
	break;
      default:
	if (!isAlnum(c))
	  return false;
	break;
      }
    }
    return false;
  }