groovy git commit: GROOVY-8467: IOGroovyMethods readLine(Reader) method works in unexpected way

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

groovy git commit: GROOVY-8467: IOGroovyMethods readLine(Reader) method works in unexpected way

paulk
Repository: groovy
Updated Branches:
  refs/heads/master f558132be -> af2073c6b


GROOVY-8467: IOGroovyMethods readLine(Reader) method works in unexpected way


Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/af2073c6
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/af2073c6
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/af2073c6

Branch: refs/heads/master
Commit: af2073c6b7a4122c05ac9562160c8ff8e742fa6d
Parents: f558132
Author: paulk <[hidden email]>
Authored: Thu Feb 8 22:57:28 2018 +1000
Committer: paulk <[hidden email]>
Committed: Thu Feb 8 22:57:49 2018 +1000

----------------------------------------------------------------------
 .../java/org/codehaus/groovy/runtime/IOGroovyMethods.java | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/af2073c6/src/main/java/org/codehaus/groovy/runtime/IOGroovyMethods.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/codehaus/groovy/runtime/IOGroovyMethods.java b/src/main/java/org/codehaus/groovy/runtime/IOGroovyMethods.java
index 5fd2ef1..f65c85f 100644
--- a/src/main/java/org/codehaus/groovy/runtime/IOGroovyMethods.java
+++ b/src/main/java/org/codehaus/groovy/runtime/IOGroovyMethods.java
@@ -636,11 +636,19 @@ public class IOGroovyMethods extends DefaultGroovyMethodsSupport {
     }
 
     /**
-     * Read a single, whole line from the given Reader.
+     * Read a single, whole line from the given Reader. This method is designed for use with
+     * Readers that support the {@code mark()} operation like BufferReader. It has a fallback
+     * behavior for Readers that don't support mark() but the behavior doesn't correctly
+     * detect multi-character line termination (e.g. carriage return followed by linefeed).
+     * We recommend for Readers that don't support mark() you consider using one of the
+     * following methods instead: eachLine, readLines, or iterator.
      *
      * @param self a Reader
      * @return a line
      * @throws IOException if an IOException occurs.
+     * @see #readLines(java.io.Reader)
+     * @see #iterator(java.io.Reader)
+     * @see #eachLine(java.io.Reader, groovy.lang.Closure)
      * @since 1.0
      */
     public static String readLine(Reader self) throws IOException {