public class WindowsLineEndingInputStream
extends java.io.InputStream
Modifier and Type | Field and Description |
---|---|
private boolean |
atEos |
private boolean |
atSlashCr |
private boolean |
atSlashLf |
private java.io.InputStream |
in |
private boolean |
injectSlashLf |
private boolean |
lineFeedAtEndOfFile |
Constructor and Description |
---|
WindowsLineEndingInputStream(java.io.InputStream in,
boolean ensureLineFeedAtEndOfFile)
Constructs an input stream that filters another stream
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the stream.
|
private int |
handleEos()
Handles the end of stream condition.
|
void |
mark(int readLimit) |
int |
read() |
private int |
readWithUpdate()
Reads the next item from the target, updating internal flags in the process
|
private boolean atEos
private boolean atSlashCr
private boolean atSlashLf
private final java.io.InputStream in
private boolean injectSlashLf
private final boolean lineFeedAtEndOfFile
public WindowsLineEndingInputStream(java.io.InputStream in, boolean ensureLineFeedAtEndOfFile)
in
- The input stream to wrapensureLineFeedAtEndOfFile
- true to ensure that the file ends with CRLFpublic void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in class java.io.InputStream
java.io.IOException
- upon errorprivate int handleEos()
public void mark(int readLimit)
mark
in class java.io.InputStream
public int read() throws java.io.IOException
read
in class java.io.InputStream
java.io.IOException
private int readWithUpdate() throws java.io.IOException
java.io.IOException
- upon error