diff options
author | Michael Bien <[email protected]> | 2011-09-13 17:29:15 +0200 |
---|---|---|
committer | Michael Bien <[email protected]> | 2011-09-13 17:29:15 +0200 |
commit | a1545821e475736740953a02762c491f7c37cec7 (patch) | |
tree | 757fdc4f174eb4c778b16799197a3db653c2e396 /src/com/jogamp/opencl | |
parent | 749b7ecbe80164788264d460814a8454d063a6db (diff) |
better buffering in source reader.
Diffstat (limited to 'src/com/jogamp/opencl')
-rw-r--r-- | src/com/jogamp/opencl/CLContext.java | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/com/jogamp/opencl/CLContext.java b/src/com/jogamp/opencl/CLContext.java index 235bb3a8..45fdee64 100644 --- a/src/com/jogamp/opencl/CLContext.java +++ b/src/com/jogamp/opencl/CLContext.java @@ -36,7 +36,6 @@ import com.jogamp.opencl.CLSampler.FilteringMode; import com.jogamp.common.nio.NativeSizeBuffer; import com.jogamp.opencl.llb.CLContextBinding; import com.jogamp.opencl.llb.impl.CLImageFormatImpl; -import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; @@ -282,12 +281,14 @@ public class CLContext extends CLObjectResource { throw new IllegalArgumentException("input stream array was empty"); StringBuilder sb = new StringBuilder(2048*sources.length); + char[] buffer = new char[1024]; + for (InputStream source : sources) { - BufferedReader reader = new BufferedReader(new InputStreamReader(source)); + InputStreamReader reader = new InputStreamReader(source); try { - String line; - while ((line = reader.readLine()) != null) - sb.append(line).append("\n"); + int len = 0; + while ((len = reader.read(buffer)) != -1) + sb.append(buffer, 0, len); } finally { reader.close(); } |