summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2014-08-28 19:07:36 +0200
committerSven Gothel <[email protected]>2014-08-28 19:07:36 +0200
commit28ad09d75c7565983fb43e83da6e1726f92677db (patch)
tree371e4bd6cda3541685960de96b9453ea49231908
parent262592bc9d692fb4fa5f79eab7994998151b3ed1 (diff)
glsl.sdk.CompileShader: Use IOUtil.StreamMonitor
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/glsl/sdk/CompileShader.java34
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
- }
- }
- }
}