aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/apache/commons/io/input/UnixLineEndingInputStream.java
diff options
context:
space:
mode:
authorKristian Rosenvold <krosenvold@apache.org>2015-06-21 18:44:49 +0000
committerKristian Rosenvold <krosenvold@apache.org>2015-06-21 18:44:49 +0000
commit7c58d8a9919c5c9dbc1485a21d56bb3f37444060 (patch)
treebeb6e0b44ccd58ff8d9f5697be45d5d12c79d896 /src/main/java/org/apache/commons/io/input/UnixLineEndingInputStream.java
parenta053fefc0e9349ad5e97ff2353e3a8cf6873bfa7 (diff)
downloadapache-commons-io-7c58d8a9919c5c9dbc1485a21d56bb3f37444060.tar.gz
Fixed all checkstyle errors and a findbugs error
Findbugs error was: org.apache.commons.io.output.DeferredFileOutputStream#thresholdReached possible file handle leak upon exception Also contains fix for IO-446, submitted by Jeffrey Barrus git-svn-id: https://svn.apache.org/repos/asf/commons/proper/io/trunk@1686747 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/main/java/org/apache/commons/io/input/UnixLineEndingInputStream.java')
-rw-r--r--src/main/java/org/apache/commons/io/input/UnixLineEndingInputStream.java11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/main/java/org/apache/commons/io/input/UnixLineEndingInputStream.java b/src/main/java/org/apache/commons/io/input/UnixLineEndingInputStream.java
index 820eb865..7464c359 100644
--- a/src/main/java/org/apache/commons/io/input/UnixLineEndingInputStream.java
+++ b/src/main/java/org/apache/commons/io/input/UnixLineEndingInputStream.java
@@ -48,6 +48,11 @@ public class UnixLineEndingInputStream extends InputStream {
this.ensureLineFeedAtEndOfFile = ensureLineFeedAtEndOfFile;
}
+ /**
+ * Reads the next item from the target, updating internal flags in the process
+ * @return the next int read from the target stream
+ * @throws IOException upon error
+ */
private int readWithUpdate() throws IOException {
final int target = this.target.read();
eofSeen = target == -1;
@@ -86,6 +91,11 @@ public class UnixLineEndingInputStream extends InputStream {
}
}
+ /**
+ * Handles the eof-handling at the end of the stream
+ * @param previousWasSlashR Indicates if the last seen was a \r
+ * @return The next char to output to the stream
+ */
private int eofGame(boolean previousWasSlashR) {
if ( previousWasSlashR || !ensureLineFeedAtEndOfFile ) {
return -1;
@@ -100,6 +110,7 @@ public class UnixLineEndingInputStream extends InputStream {
/**
* Closes the stream. Also closes the underlying stream.
+ * @throws IOException upon error
*/
@Override
public void close() throws IOException {