summaryrefslogtreecommitdiffstats
path: root/src/com/jogamp/opencl/CLContext.java
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2011-06-28 14:13:22 +0200
committerSven Gothel <[email protected]>2011-06-28 14:13:22 +0200
commitda0378be055d5c304b0a0b5e1b5f3ca66122ebf8 (patch)
tree26ca2e70da90e0c43c30a51d8d0cbe6c9ca2809f /src/com/jogamp/opencl/CLContext.java
parent368f062ec9d6bbb89129739adb59cf042dd0bf78 (diff)
parent08a479b22d4ba9da9ee79fc938ac4de7fb83dc5a (diff)
Fix last merge of mbien/master
Diffstat (limited to 'src/com/jogamp/opencl/CLContext.java')
-rw-r--r--src/com/jogamp/opencl/CLContext.java9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/com/jogamp/opencl/CLContext.java b/src/com/jogamp/opencl/CLContext.java
index c8a847a2..43755c37 100644
--- a/src/com/jogamp/opencl/CLContext.java
+++ b/src/com/jogamp/opencl/CLContext.java
@@ -242,7 +242,7 @@ public class CLContext extends CLObject implements CLResource {
}
/**
- * Creates a program from the given sources, the program is not build yet.
+ * Creates a program from the given sources, the returned program is not build yet.
*/
public CLProgram createProgram(String src) {
CLProgram program = CLProgram.create(this, src);
@@ -251,7 +251,8 @@ public class CLContext extends CLObject implements CLResource {
}
/**
- * Creates a program and reads the source from stream, the program is not build yet.
+ * Creates a program and reads the source from stream, the returned program is not build yet.
+ * The InputStream is automatically closed after the sources have been read.
* @throws IOException when a IOException occurred while reading or closing the stream.
*/
public CLProgram createProgram(InputStream source) throws IOException {
@@ -260,14 +261,14 @@ public class CLContext extends CLObject implements CLResource {
throw new IllegalArgumentException("input stream for program source must not be null");
BufferedReader reader = new BufferedReader(new InputStreamReader(source));
- StringBuilder sb = new StringBuilder();
+ StringBuilder sb = new StringBuilder(2048);
String line;
try {
while ((line = reader.readLine()) != null)
sb.append(line).append("\n");
} finally {
- source.close();
+ reader.close();
}
return createProgram(sb.toString());