harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From odea...@apache.org
Subject svn commit: r593201 - /harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/BufferedReader.java
Date Thu, 08 Nov 2007 15:32:23 GMT
Author: odeakin
Date: Thu Nov  8 07:32:22 2007
New Revision: 593201

URL: http://svn.apache.org/viewvc?rev=593201&view=rev
Log:
Handle the EBCDIC 'NEL' (new line) character in BufferedReader.readLine().

Modified:
    harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/BufferedReader.java

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/BufferedReader.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/BufferedReader.java?rev=593201&r1=593200&r2=593201&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/BufferedReader.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/BufferedReader.java
Thu Nov  8 07:32:22 2007
@@ -299,8 +299,10 @@
      * Answers a <code>String</code> representing the next line of text
      * available in this BufferedReader. A line is represented by 0 or more
      * characters followed by <code>'\n'</code>, <code>'\r'</code>,
-     * <code>'\r\n'</code> or end of stream. The <code>String</code>
does
-     * not include the newline sequence.
+     * <code>'\r\n'</code> or end of stream. The <code>String</code>
does not
+     * include the newline sequence. 
+     * In EBCDIC systems, a new line can also be represented by the 
+     * <code>'\u0085'</code> (NEL) character.
      * 
      * @return the contents of the line or null if no characters were read
      *         before end of stream.
@@ -335,6 +337,11 @@
                         pos++;
                     }
                     return res;
+                } else if (ch == '\u0085') {
+                    /* Also handle the EBCDIC NEL character */
+                    String res = new String(buf, pos, charPos - pos);
+                    pos = charPos + 1;
+                    return res;
                 }
             }
 
@@ -359,7 +366,7 @@
                 }
                 for (int charPos = pos; charPos < count; charPos++) {
                     if (eol == '\0') {
-                        if ((buf[charPos] == '\n' || buf[charPos] == '\r')) {
+                        if ((buf[charPos] == '\n' || buf[charPos] == '\r') || (buf[charPos]
== '\u0085')) {
                             eol = buf[charPos];
                         }
                     } else if (eol == '\r' && (buf[charPos] == '\n')) {



Mime
View raw message