Package org.apache.commons.io.input
Class UnixLineEndingInputStream
java.lang.Object
java.io.InputStream
org.apache.commons.io.input.AbstractLineEndingInputStream
org.apache.commons.io.input.UnixLineEndingInputStream
- All Implemented Interfaces:
Closeable,AutoCloseable
A filtering input stream that ensures the content will have UNIX-style line endings, LF.
- Since:
- 2.5
-
Field Summary
Fields inherited from class org.apache.commons.io.input.AbstractLineEndingInputStream
atEos, atSlashCr, atSlashLf, in, lineFeedAtEos -
Constructor Summary
ConstructorsConstructorDescriptionUnixLineEndingInputStream(InputStream inputStream, boolean lineFeedAtEos) Constructs an input stream that filters another stream -
Method Summary
Methods inherited from class org.apache.commons.io.input.AbstractLineEndingInputStream
close, markMethods inherited from class java.io.InputStream
available, markSupported, read, read, reset, skip
-
Constructor Details
-
UnixLineEndingInputStream
Constructs an input stream that filters another stream- Parameters:
inputStream- The input stream to wrap.lineFeedAtEos- true to ensure that the file ends with LF.
-
-
Method Details
-
handleEos
private int handleEos(boolean previousWasSlashCr) Handles the end of stream condition.- Parameters:
previousWasSlashCr- Indicates if the last seen was a\r.- Returns:
- The next char to output to the stream.
-
read
- Specified by:
readin classInputStream- Throws:
IOException
-
readUpdate
Reads the next item from the target, updating internal flags in the process- Returns:
- the next int read from the target stream.
- Throws:
IOException- If an I/O error occurs.
-