示例#1
0
  public static void main(String[] args) throws IOException {

    boolean helyes = false;
    int i = 0;
    String aa = "al";
    do {
      System.out.println("-----Weclome!-----");
      System.out.println("a. - Soronkent szeretne keresni!");
      System.out.println("b. - Szavankent szeretne keresni!");
      System.out.println("c. - Ne legyen kis/nagy betuerzekeny!");
      System.out.println("x. - Kilep");
      System.out.println("------------------");
      String s = System.console().readLine();
      if (s.equals("x")) {
        helyes = true;
      } else {
        if (s.equals("a")) {
          System.out.println("irja':");
          String line = System.console().readLine();
          try {
            findTextLine(line, args[0]);
          } catch (FileNotFoundException e) {
            System.out.println("A kov fajl nem talalhato: " + args[0]);
          }
          helyes = true;
        }
        if (s.equals("b")) {
          System.out.println("irja':");
          String word = System.console().readLine();
          try {
            findTextWord(word, args[0]);
          } catch (FileNotFoundException e) {
            System.out.println("A kov fajl nem talalhato: " + args[0]);
          }
          helyes = true;
        }
        if (s.equals("c")) {
          System.out.println("irja':");
          String line = System.console().readLine();
          try {
            findTextWordNoCaps(line, args[0]);
          } catch (FileNotFoundException e) {
            System.out.println("A kov fajl nem talalhato: " + args[0]);
          }
          helyes = true;
        }
      }
    } while (helyes == false);
  }
示例#2
0
 public int[] menu() {
   int[] answers = {0, 0, 0};
   // helyértékek: 0 = isCaseSensitive,1 = isItYesOrNo,2 = helyes
   // 0 érték a hamis, 1 érték az igaz
   String s = System.console().readLine();
   if (s.equals("x")) {
     answers[2] = 1;
   } else {
     if (s.equals("i") || s.equals("I")) {
       answers[0] = 1;
       answers[1] = 1;
       answers[2] = 1;
     }
     if (s.equals("n") || s.equals("N")) {
       answers[0] = 0;
       answers[1] = 1;
       answers[2] = 1;
     }
   }
   return answers;
 }
示例#3
0
 public String askWords() {
   System.out.println("Kerem a keresendo kifejezest:");
   String words = System.console().readLine();
   return words;
 }
示例#4
0
 /**
  * Test whether the given file descriptor refers to a terminal.
  *
  * @param fd the file descriptor to test
  * @return 1 if fd refers to a terminal, 0 otherwise
  */
 public int isatty(int fd) {
   if (fd < 0 || fd > 2) return 0;
   return System.console() != null ? 1 : 0;
 }