commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject svn commit: r1415701 - /commons/proper/io/trunk/src/main/java/org/apache/commons/io/input/CharSequenceInputStream.java
Date Fri, 30 Nov 2012 15:39:13 GMT
Author: ggregory
Date: Fri Nov 30 15:39:12 2012
New Revision: 1415701

URL: http://svn.apache.org/viewvc?rev=1415701&view=rev
Log:
Replace magic number with private constant EOS (End Of Stream).

Modified:
    commons/proper/io/trunk/src/main/java/org/apache/commons/io/input/CharSequenceInputStream.java

Modified: commons/proper/io/trunk/src/main/java/org/apache/commons/io/input/CharSequenceInputStream.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/main/java/org/apache/commons/io/input/CharSequenceInputStream.java?rev=1415701&r1=1415700&r2=1415701&view=diff
==============================================================================
--- commons/proper/io/trunk/src/main/java/org/apache/commons/io/input/CharSequenceInputStream.java
(original)
+++ commons/proper/io/trunk/src/main/java/org/apache/commons/io/input/CharSequenceInputStream.java
Fri Nov 30 15:39:12 2012
@@ -39,6 +39,8 @@ public class CharSequenceInputStream ext
 
     private static final int BUFFER_SIZE = 2048;
     
+    private static final int EOS = -1;
+
     private static final int NO_MARK = -1;
 
     private final CharsetEncoder encoder;
@@ -126,7 +128,7 @@ public class CharSequenceInputStream ext
             return 0; // must return 0 for zero length read
         }
         if (!this.bbuf.hasRemaining() && !this.cbuf.hasRemaining()) {
-            return -1;
+            return EOS;
         }
         int bytesRead = 0;
         while (len > 0) {
@@ -143,7 +145,7 @@ public class CharSequenceInputStream ext
                 }
             }
         }
-        return bytesRead == 0 && !this.cbuf.hasRemaining() ? -1 : bytesRead;
+        return bytesRead == 0 && !this.cbuf.hasRemaining() ? EOS : bytesRead;
     }
 
     @Override
@@ -154,7 +156,7 @@ public class CharSequenceInputStream ext
             } else {
                 fillBuffer();
                 if (!this.bbuf.hasRemaining() && !this.cbuf.hasRemaining()) {
-                    return -1;
+                    return EOS;
                 }
             }
         }



Mime
View raw message