public static void redirectStreams ( Process process , OutputStream output , OutputStream error ) { if ( output != null ) new Thread ( new IOPump ( process . getInputStream ( ) , output , false , false ) . asRunnable ( ) ) . start ( ) ; if ( error != null ) new Thread ( new IOPump ( process . getErrorStream ( ) , error , false , false ) . asRunnable ( ) ) . start ( ) ; }
Redirects given process s input and error streams to the specified streams . the streams specified are not closed automatically . The streams passed can be null if you don t want to redirect them .