From 28ad09d75c7565983fb43e83da6e1726f92677db Mon Sep 17 00:00:00 2001
From: Sven Gothel <sgothel@jausoft.com>
Date: Thu, 28 Aug 2014 19:07:36 +0200
Subject: glsl.sdk.CompileShader: Use IOUtil.StreamMonitor

---
 .../jogamp/opengl/util/glsl/sdk/CompileShader.java | 34 +---------------------
 1 file changed, 1 insertion(+), 33 deletions(-)

(limited to 'src/jogl/classes/com/jogamp')

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
-            }
-        }
-    }
 }
-- 
cgit v1.2.3