日期:2014-05-20  浏览次数:20635 次

关于exec的即时输出
采用exec+读取流的方式,如果有大量输出,就会等发起的进程运行完了以后才能读出,java中有什么方式可以让新进程有一点out就马上传递给流,然后读出呢?

------解决方案--------------------
会不会是这个方法
Runtime.getRuntime().getLocalizedOutputStream(out)
------解决方案--------------------
* Creates a localized version of an output stream. This method 
* takes an <code>OutputStream</code> and returns an 
* <code>OutputStream</code> equivalent to the argument in all respects 
* except that it is localized: as Unicode characters are written to 
* the stream, they are automatically converted to the local 
* character set. 

把这个流放到线程后,传给Runtime,我是猜想的。。。。。不知道楼主是否会借鉴。
------解决方案--------------------
把线程的优先级调成最高试试。