1 Reply Latest reply: Sep 30, 2010 3:19 AM by EJP RSS

    reading inputstream from the exec process

    801984
      I am trying to read a 7zip compressed file in Java. No InputStreamer exists for 7zip compression, so I read it using Process.exec:

      Process proc = shell.exec("7z x very_big_file.7z -so ");

      Thread.currentThread().sleep(1000);
      BufferedReader br = new BufferedReader(new InputStreamReader(proc.getInputStream()));
      while(br.ready()) {
      System.out.println(br.readLine());
      }

      Question: if I drop the sleep command above, the buffer is not ready, and I do not get any strings from the executed process. How can I force the reader to check wheather EOF is reached, and not wheather the the buffer is ready?