From dcf83966f7fdd5bfc0753f29d763dfd85e1bfb1e Mon Sep 17 00:00:00 2001 From: Michael Bien Date: Wed, 18 May 2011 23:50:43 +0200 Subject: clarified stream closing in javadoc, initial capacity for StringBuilder. --- src/com/jogamp/opencl/CLContext.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/com') 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()); -- cgit v1.2.3