You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2014/04/10 16:05:17 UTC
svn commit: r1586307 -
/commons/proper/io/trunk/src/main/java/org/apache/commons/io/input/BOMInputStream.java
Author: ggregory
Date: Thu Apr 10 14:05:16 2014
New Revision: 1586307
URL: http://svn.apache.org/r1586307
Log:
Refactor magic number into constant.
Modified:
commons/proper/io/trunk/src/main/java/org/apache/commons/io/input/BOMInputStream.java
Modified: commons/proper/io/trunk/src/main/java/org/apache/commons/io/input/BOMInputStream.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/main/java/org/apache/commons/io/input/BOMInputStream.java?rev=1586307&r1=1586306&r2=1586307&view=diff
==============================================================================
--- commons/proper/io/trunk/src/main/java/org/apache/commons/io/input/BOMInputStream.java (original)
+++ commons/proper/io/trunk/src/main/java/org/apache/commons/io/input/BOMInputStream.java Thu Apr 10 14:05:16 2014
@@ -85,6 +85,7 @@ import org.apache.commons.io.ByteOrderMa
* @since 2.0
*/
public class BOMInputStream extends ProxyInputStream {
+ private static final int EOF = -1;
private final boolean include;
/**
* BOMs are sorted from longest to shortest.
@@ -140,7 +141,7 @@ public class BOMInputStream extends Prox
final int len1 = bom1.length();
final int len2 = bom2.length();
if (len1 > len2) {
- return -1;
+ return EOF;
}
if (len2 > len1) {
return 1;
@@ -260,7 +261,7 @@ public class BOMInputStream extends Prox
*/
private int readFirstBytes() throws IOException {
getBOM();
- return fbIndex < fbLength ? firstBytes[fbIndex++] : -1;
+ return fbIndex < fbLength ? firstBytes[fbIndex++] : EOF;
}
/**
@@ -340,7 +341,7 @@ public class BOMInputStream extends Prox
}
}
final int secondCount = in.read(buf, off, len);
- return secondCount < 0 ? firstCount > 0 ? firstCount : -1 : firstCount + secondCount;
+ return secondCount < 0 ? firstCount > 0 ? firstCount : EOF : firstCount + secondCount;
}
/**