Replace magic number with constant.
MODIFY
src/main/java/org/apache/commons/io/input/UnixLineEndingInputStream.java
src/main/java/org/apache/commons/io/input/UnixLineEndingInputStream.java
*/
package org.apache.commons.io.input;
+import static org.apache.commons.io.IOUtils.EOF;
import java.io.IOException;
import java.io.InputStream;
@@ -55,7 +56,7 @@ public UnixLineEndingInputStream(final InputStream in, final boolean ensureLineF
*/
private int readWithUpdate() throws IOException {
final int target = this.target.read();
- eofSeen = target == -1;
+ eofSeen = target == EOF;
if (eofSeen) {
return target;
}
@@ -95,13 +96,13 @@ public int read() throws IOException {
*/
private int eofGame(final boolean previousWasSlashR) {
if (previousWasSlashR || !ensureLineFeedAtEndOfFile) {
- return -1;
+ return EOF;
}
if (!slashNSeen) {
slashNSeen = true;
return '\n';
}
- return -1;
+ return EOF;
}
/**

MODIFY
src/main/java/org/apache/commons/io/input/WindowsLineEndingInputStream.java
src/main/java/org/apache/commons/io/input/WindowsLineEndingInputStream.java
*/
package org.apache.commons.io.input;
+import static org.apache.commons.io.IOUtils.EOF;
+
import java.io.IOException;
import java.io.InputStream;
@@ -56,7 +58,7 @@ public WindowsLineEndingInputStream(final InputStream in, final boolean ensureLi
*/
private int readWithUpdate() throws IOException {
final int target = this.target.read();
- eofSeen = target == -1;
+ eofSeen = target == EOF;
if (eofSeen) {
return target;
}
@@ -98,7 +100,7 @@ public int read() throws IOException {
private int eofGame() {
if (!ensureLineFeedAtEndOfFile) {
- return -1;
+ return EOF;
}
if (!slashNSeen && !slashRSeen) {
slashRSeen = true;
@@ -109,7 +111,7 @@ private int eofGame() {
slashNSeen = true;
return '\n';
}
- return -1;
+ return EOF;
}
/**

Replace magic number with constant.