title: Using inputStream and OutputStream to read and write data to a process
body: <p>I am currently running a <code>.class</code> file as a process. The <code>.class</code> file is a simple program that asks the user to input a number, takes the input and prints the user's input back to the screen. 
  Up to now, i have managed to print the "Enter a number: " statement from the process on the console through <code>InputStream</code> and write the input entered by the user through <code>OutputStream</code>. I am unable to print the last statements on the screen, which should be </p>
  
  <blockquote>
    <p>"You entered : " + userinput</p>
  </blockquote>
  
  <p>My code is: </p>
  
  <pre><code>String command [] = {"java" , "-cp", "C:\\Users\\Mahika\\Documents\\NetBeansProjects\\JavaTest\\compilerTest", "InputInteger"};
  ProcessBuilder pb = new ProcessBuilder(command);
  Process p = pb.start();
  System.out.println("Process started");
  BufferedReader br = new BufferedReader (new InputStreamReader(p.getInputStream()));
  String output = null;
  
  while((output = br.readLine()) != null){
      System.out.println(output);
      break;
  }
  Scanner sc = new Scanner(System.in);
  int i = sc.nextInt();
  
  OutputStream os = p.getOutputStream();
  PrintStream ps = new PrintStream(os);
  os.write(i);
  os.flush();  
  </code></pre>
  
  <p>I don't know how to use <code>InputStream</code> again to read the "You entered:" + userinput. </p>