@Test public void testGobbleStream() throws Exception { byte[] bytes = new byte[] {'a','b','c'}; InputStream stream = new ByteArrayInputStream(bytes); ByteArrayOutputStream out = new ByteArrayOutputStream(); StreamGobbler gobbler = new StreamGobbler(stream, out, null); gobbler.start(); try { gobbler.join(10*1000); assertFalse(gobbler.isAlive()); assertEquals(new String(out.toByteArray()), "abc" + NL); } finally { gobbler.close(); gobbler.interrupt(); } }
@Override public void close() { running.set(false); interrupt(); }
StreamGobbler extends Thread implements Closeable { @Override public void close() { running.set(false); interrupt(); } }
StreamGobbler extends Thread implements Closeable { @Override public void close() { running.set(false); interrupt(); } StreamGobbler(InputStream stream, OutputStream out, Logger log);  StreamGobbler(InputStream stream, PrintStream out, Logger log); }
StreamGobbler extends Thread implements Closeable { @Override public void close() { running.set(false); interrupt(); } StreamGobbler(InputStream stream, OutputStream out, Logger log);  StreamGobbler(InputStream stream, PrintStream out, Logger log); @Override void close(); @Deprecated void shutdown(); StreamGobbler setPrefix(String prefix); StreamGobbler setPrintPrefix(String prefix); StreamGobbler setLogPrefix(String prefix); @Override void run(); void onChar(int c); void onLine(String line); void onClose(); void blockUntilFinished(); boolean isFinished(); }
StreamGobbler extends Thread implements Closeable { @Override public void close() { running.set(false); interrupt(); } StreamGobbler(InputStream stream, OutputStream out, Logger log);  StreamGobbler(InputStream stream, PrintStream out, Logger log); @Override void close(); @Deprecated void shutdown(); StreamGobbler setPrefix(String prefix); StreamGobbler setPrintPrefix(String prefix); StreamGobbler setLogPrefix(String prefix); @Override void run(); void onChar(int c); void onLine(String line); void onClose(); void blockUntilFinished(); boolean isFinished();  }