Java.lang.Process.getOutputStream() Method Example
JAVA.LANG.PROCESS.GETOUTPUTSTREAM METHOD
Copyright ?
Description
The java.lang.Process.getOutputStream method gets the output stream of the subprocess.
Output to the stream is piped into the standard input stream of the process represented by this
Process object.
Declaration
Following is the declaration for java.lang.Process.getOutputStream method
public abstract OutputStream getOutputStream()
Parameters
NA
Return Value
This method returns the output stream connected to the normal input of the subprocess.
Exception
NA
Example
The following example shows the usage of lang.Process.getOutputStream method.
package com.tutorialspoint;
import java.io.BufferedOutputStream;
import java.io.OutputStream;
public class ProcessDemo {
public static void main(String[] args) {
try {
// create a new process
System.out.println("Creating Process...");
Process p = Runtime.getRuntime().exec("notepad.exe");
// get the output stream
OutputStream out = p.getOutputStream();
// close the output stream
System.out.println("Closing the output stream...");
out.close();
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
Let us compile and run the above program, this will produce the following result:
Creating Process...
Closing the output stream...
Loading [MathJax]/jax/output/HTML-CSS/fonts/TeX/fontdata.js
................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related download
- byte streams example 1 counting characters
- c input output streams virginia tech
- apache commons io
- input and output streams part ii
- i o input dan output nuribrahim s blog
- lecture 20 department of computer science and engineering
- getoutputstream method example
- lecture 2 streams
- output streams in c github pages
- streams and file i o purdue university
Related searches
- example of business process document
- java array example code
- java example code for beginners
- example of java program
- example java code hello world
- java get calling method name
- example of a process paper
- example of policy process procedure
- java reflection get method name
- java main method string args
- tostring method java array
- boolean method example java