流程类的getOutputStream()方法 (Process Class getOutputStream() method)

  • getOutputStream() method is available in java.lang package.

    getOutputStream()方法在java.lang包中可用。

  • getOutputStream() method is used to get the output stream of the process and sub-process.

    getOutputStream()方法用于获取流程和子流程的输出流。

  • getOutputStream() method is a non-static method, it is accessible with the class object only and if we try to access the method with the class name then we will get an error.

    getOutputStream()方法是一个非静态方法,只能通过类对象访问,如果尝试使用类名称访问该方法,则会收到错误消息。

  • getOutputStream() method does not throw an exception at the time of returning output stream.

    返回输出流时, getOutputStream()方法不会引发异常。

Syntax:

句法:

    public abstract OutputStream getOutputStream();

Parameter(s):

参数:

  • It does not accept any parameter.

    它不接受任何参数。

Return value:

返回值:

The return type of this method is OutputStream, it returns output stream associated to the standard input of the process.

此方法的返回类型为OutputStream ,它返回与流程的标准输入关联的输出流。

Example:

例:

// Java program to demonstrate the example
// of OutputStream getOutputStream() method of Process
import java.io.*;
import java.util.*;
public class GetOutputStream {public static void main(String[] args) throws Exception {// Instantiating Process object
System.out.println("Process Instantiated");
Process pr = Runtime.getRuntime().exec("notepad.exe");
// By using getOutputStream() method is to get the
// output stream of pr object
OutputStream os = pr.getOutputStream();
// By using close() method is to close the output stream
System.out.println("Output Stream Closed :");
os.close();
}
}

Output

输出量

Process Instantiated
Output Stream Closed :

翻译自: https://www.includehelp.com/java/process-getoutputstream-method-with-example.aspx

Java Process getOutputStream()方法与示例相关推荐

  1. java exec waitfor,Java Process waitFor()方法与示例

    流程类waitFor()方法在java.lang包中提供了waitFor()方法. waitFor()方法用于使当前正在运行的线程在需要时等待,直到由该Process对象表示的进程完成其终止为止. 当 ...

  2. java中setid(),Java Process.setId方法代碼示例

    本文整理匯總了Java中org.activiti.bpmn.model.Process.setId方法的典型用法代碼示例.如果您正苦於以下問題:Java Process.setId方法的具體用法?Ja ...

  3. Java IOUtils.copy方法代码示例(亲测)

    本文整理汇总了Java中org.apache.commons.io.IOUtils.copy方法的典型用法代码示例.如果您正苦于以下问题:Java IOUtils.copy方法的具体用法?Java I ...

  4. java getoutputstream_Java Connection.getOutputStream方法代码示例

    import sun.rmi.transport.Connection; //导入方法依赖的package包/类 /** * handleMessages decodes transport oper ...

  5. java user directory,Java ProcessBuilder directory()方法与示例

    语法:public File directory (); public ProcessBuilder directory (File dir); ProcessBuilder类directory()方 ...

  6. Java序列化魔术方法及其示例使用

    在上一篇文章中, 您需要了解有关Java序列化的所有知识 ,我们讨论了如何通过实现Java序列化来启用类的可序列化性. Serializable接口. 如果我们的类未实现Serializable接口, ...

  7. catalog java,Java Connection getCatalog()方法与示例

    通常,目录是一个目录,其中包含有关数据集,文件或数据库的信息.而数据库目录中包含所有数据库,基本表,视图(虚拟表),同义词,值范围,索引,用户和用户组的列表. Connection接口的getCata ...

  8. filepermission java,Java FilePermission getActions()方法与示例

    FilePermission类getActions()方法getActions()方法在java.io包中可用. getActions()方法用于检查此FilePermission和给定对象在路径名和 ...

  9. java方法参数Bundle,Java ResourceBundle keySet()方法及示例

    ResourceBundle类keySet()方法keySet()方法在java.util包中可用. keySet()方法用于从此ResourceBundle及其超级捆绑包中获取所有现有键,以在Set ...

最新文章

  1. 索引系列八--索引特性之有序难优化union
  2. 2017-2018-2 『网络对抗技术』Exp1:PC平台逆向破解 20165335
  3. 重写数组的方法(改变原数组)
  4. python观察日志(part4)--字符串拼接方式
  5. POJ-1386 Play on Words 有向图欧拉通路判定
  6. 2020全国计算机专业考研学校
  7. 从面向对象的api中识别软件组件(论文翻译)
  8. 小D课堂 - 新版本微服务springcloud+Docker教程_6-05 高级篇幅之高并发情况下
  9. 算法(四)、时间复杂度、排序、查找
  10. Excel VBA宏编程入门(五)——用户交互
  11. 好网站:字体转换器在线转换 http://www.diyiziti.com/
  12. 【直通华为HCNA/HCNP系列R篇5】DHCP服务配置与管理-王达-专题视频课程
  13. JSP从入门到精通_课堂实战视频教程
  14. Mybiosource丨Mybiosource玻连蛋白 (VTN),ELISA 试剂盒原理
  15. java二级大题分值_2017年9月全国计算机等级考试各级别题型分值
  16. win10误删的注册表能还原吗_win10注册表删错了怎么办_win10注册表删错东西如何恢复-win7之家...
  17. focusky导出html修改,Focusky输出HTML MP4 EXE APP ZIP动画演示文件
  18. 美赛BOOM数学建模4-3马尔科夫预测
  19. 固实压缩文件容易损坏_winrar应用:创建分卷固实压缩带恢复记录的压缩文件 [原创]...
  20. 如何用python画数学图案_使用Matplotlib 绘制精美的数学图形例子

热门文章

  1. flash 用 html 播放,使用flash插件在HTML上播放音频
  2. 清华计算机接口原理,微机原理与接口技术课后习题答案清华大学
  3. zabbix5.2安装-linux
  4. Ubuntu下面apache2安装
  5. go之树型结构深度理解补充
  6. Node.js 根本没有这样搞性能优化的?
  7. Caffe学习记录(十一) ICNet分割网络学习
  8. CF1045G AI robots(动态开点线段树)
  9. ruby 爬虫爬取拉钩网职位信息,产生词云报告
  10. R语言:ggplot2精细化绘图——以实用商业化图表绘图为例(转)