Process: getOutputStream() : Process « java.lang « Java by API






Process: getOutputStream()

  
import java.io.OutputStream;

public class Main {
  public static void main(String[] argv) throws Exception {
    String command = "cat";
    Process child = Runtime.getRuntime().exec(command);
    OutputStream out = child.getOutputStream();
    out.write("some text".getBytes());
    out.close();
  }
}

   
    
  








Related examples in the same category

1.Process: getInputStream()
2.Process: waitFor()
3.Process: exitValue()