diff options
-rw-r--r-- | src/jogl/classes/com/jogamp/opengl/util/glsl/sdk/CompileShader.java | 34 |
1 files changed, 1 insertions, 33 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/util/glsl/sdk/CompileShader.java b/src/jogl/classes/com/jogamp/opengl/util/glsl/sdk/CompileShader.java index f113be2b2..1d629131e 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/glsl/sdk/CompileShader.java +++ b/src/jogl/classes/com/jogamp/opengl/util/glsl/sdk/CompileShader.java @@ -109,8 +109,7 @@ public abstract class CompileShader { tmpFile.getAbsolutePath(), outputFile.getAbsolutePath() }); // , null, processorDir); - new StreamMonitor(process.getInputStream()); - new StreamMonitor(process.getErrorStream()); + new IOUtil.StreamMonitor( new InputStream[] { process.getInputStream(), process.getErrorStream() }, System.out, null ); process.waitFor(); // Delete the temporary file // tmpFile.delete(); @@ -153,35 +152,4 @@ public abstract class CompileShader { e.printStackTrace(); } } - - private static class StreamMonitor implements Runnable { - private final InputStream istream; - public StreamMonitor(final InputStream stream) { - istream = stream; - new Thread(this, "Output Reader Thread").start(); - } - - @Override - public void run() - { - final byte[] buffer = new byte[4096]; - try { - int numRead = 0; - do { - numRead = istream.read(buffer); - if (numRead > 0) { - System.out.write(buffer, 0, numRead); - System.out.flush(); - } - } while (numRead >= 0); - } - catch (final IOException e) { - try { - istream.close(); - } catch (final IOException e2) { - } - // Should allow clean exit when process shuts down - } - } - } } |