Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2014
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.49 KB | None | 0 0
  1. try {
  2. int out = 0;
  3. String line;
  4. OutputStream stdin = null;
  5. InputStream stderr = null;
  6. InputStream stdout = null;
  7.  
  8. // calling the exe file
  9. Process process = new ProcessBuilder("unpattern.exe").start();
  10. stdin = process.getOutputStream();
  11. stderr = process.getErrorStream();
  12. stdout = process.getInputStream();
  13.  
  14. // input process
  15. // "write" the parms into stdin
  16. line = "1";
  17. stdin.write(line.getBytes());
  18. stdin.flush();
  19.  
  20. //line = "tx.getText()" + "n";
  21. // stdin.write(line.getBytes());
  22. // stdin.flush();
  23.  
  24. stdin.close();
  25. // output process
  26. // clean up if any output in stdout
  27. BufferedReader brCleanUp =
  28. new BufferedReader(new InputStreamReader(stdout));
  29.  
  30. while ((line = brCleanUp.readLine()) != null) {
  31. // counter of the defects
  32. System.out.println(line);
  33.  
  34. } catch (IOException ex) {
  35. Logger.getLogger(QeyeGui3.class.getName()).log(Level.SEVERE, null, ex);
  36. }
  37.  
  38. // ....
  39. while ((line = brCleanUp.readLine()) != null) {
  40. // counter of the defects
  41. System.out.println(line);
  42. // **** it should go here
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement