@SuppressWarnings( "checkstyle:innerassignment" ) private void feed() throws IOException { InputStream is = input.get(); OutputStream os = output.get(); boolean flush = false; if ( is != null && os != null ) { for ( int data; !isDone() && ( data = is.read() ) != -1; ) { if ( !isDisabled() ) { os.write( data ); flush = true; } } if ( flush ) { os.flush(); } } }
inputFeeder = new StreamFeeder( systemIn, p.getOutputStream() ); inputFeeder.start(); inputFeeder.waitUntilDone(); inputFeeder.close(); if ( inputFeeder.getException() != null ) throw new CommandLineException( "Failure processing stdin.", inputFeeder.getException() ); inputFeeder.disable(); inputFeeder.close();
public void close() setDone(); final InputStream is = input.getAndSet( null ); if ( is != null )