summaryrefslogtreecommitdiffstats
path: root/src/com
diff options
context:
space:
mode:
authorMichael Bien <[email protected]>2011-05-18 23:50:43 +0200
committerMichael Bien <[email protected]>2011-05-18 23:50:43 +0200
commitdcf83966f7fdd5bfc0753f29d763dfd85e1bfb1e (patch)
treed7338b8ed3b918a8b64fff85c85a40c952a51fd7 /src/com
parentf12e3a9d7ac644abc98a51dc51786cf7c5b67851 (diff)
clarified stream closing in javadoc, initial capacity for StringBuilder.
Diffstat (limited to 'src/com')
-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 850f6c0e..147fc2ae 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());