BufferedReader 和 process.getOutputStream()
我只是想在 Java 中执行一个进程,所以
Runtime runtime = Runtime.getRuntime();
this.process = null;
try {
this.process = runtime.exec(new String[] {
properties.getPropertyStr("ffmpegExecutable", "/usr/bin/ffmpeg"),
"-i", this.streamEntry.getSource(),
"-vcodec", "copy",
"-acodec", "copy",
this.streamEntry.getDestination()
});
} catch (IOException e) {
e.printStackTrace();
return;
}
BufferedReader stdout = new BufferedReader(???process.getOutputStream());
我只是希望能够逐行读取进程的输出。我该怎么做?
I'm simply trying to execute a process in Java, so
Runtime runtime = Runtime.getRuntime();
this.process = null;
try {
this.process = runtime.exec(new String[] {
properties.getPropertyStr("ffmpegExecutable", "/usr/bin/ffmpeg"),
"-i", this.streamEntry.getSource(),
"-vcodec", "copy",
"-acodec", "copy",
this.streamEntry.getDestination()
});
} catch (IOException e) {
e.printStackTrace();
return;
}
BufferedReader stdout = new BufferedReader(???process.getOutputStream());
I simply want to be able to read the output of the process line by line. How do I do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)