public class UnixLineEndingInputStream
extends java.io.InputStream
Modifier and Type | Field and Description |
---|---|
private boolean |
ensureLineFeedAtEndOfFile |
private boolean |
eofSeen |
private boolean |
slashNSeen |
private boolean |
slashRSeen |
private java.io.InputStream |
target |
Constructor and Description |
---|
UnixLineEndingInputStream(java.io.InputStream in,
boolean ensureLineFeedAtEndOfFile)
Create an input stream that filters another stream
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the stream.
|
private int |
eofGame(boolean previousWasSlashR)
Handles the eof-handling at the end of the stream
|
void |
mark(int readlimit) |
int |
read() |
private int |
readWithUpdate()
Reads the next item from the target, updating internal flags in the process
|
private boolean slashNSeen
private boolean slashRSeen
private boolean eofSeen
private final java.io.InputStream target
private final boolean ensureLineFeedAtEndOfFile
public UnixLineEndingInputStream(java.io.InputStream in, boolean ensureLineFeedAtEndOfFile)
in
- The input stream to wrapensureLineFeedAtEndOfFile
- true to ensure that the file ends with LFprivate int readWithUpdate() throws java.io.IOException
java.io.IOException
- upon errorpublic int read() throws java.io.IOException
read
in class java.io.InputStream
java.io.IOException
private int eofGame(boolean previousWasSlashR)
previousWasSlashR
- Indicates if the last seen was a \rpublic 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 errorpublic void mark(int readlimit)
mark
in class java.io.InputStream