diff options
author | Michael Bien <[email protected]> | 2009-11-08 21:48:29 +0100 |
---|---|---|
committer | Michael Bien <[email protected]> | 2009-11-08 21:48:29 +0100 |
commit | d2050aea14e6ab1a6429eab56f0612c2deb6184f (patch) | |
tree | ecb5b0fa28e3cc592b053cef7ac1dab3edcb684d /src/com/mbien/opencl/CLContext.java | |
parent | c33ac63fb62d3d27979ca56bb577c18f745f70d4 (diff) |
improved Exception handling in CLProgram and CLKernel.
introduced CLResource interface for releasable resources.
CLProgram is now rebuildable.
Diffstat (limited to 'src/com/mbien/opencl/CLContext.java')
-rw-r--r-- | src/com/mbien/opencl/CLContext.java | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/com/mbien/opencl/CLContext.java b/src/com/mbien/opencl/CLContext.java index 757e0498..04df962b 100644 --- a/src/com/mbien/opencl/CLContext.java +++ b/src/com/mbien/opencl/CLContext.java @@ -29,7 +29,7 @@ import static com.sun.gluegen.runtime.BufferFactory.*; * specified in the context. * @author Michael Bien */ -public final class CLContext { +public final class CLContext implements CLResource { final CL cl; public final long ID; @@ -180,7 +180,10 @@ public final class CLContext { * @throws IOException when a IOException occurred while reading or closing the stream. */ public CLProgram createProgram(InputStream sources) throws IOException { - + + if(sources == null) + throw new IllegalArgumentException("input stream for program sources must not be null"); + BufferedReader reader = new BufferedReader(new InputStreamReader(sources)); StringBuilder sb = new StringBuilder(); |