public class UnixLineEndingInputStream
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 |
lineFeedAtEndOfFile |
| Constructor and Description |
|---|
UnixLineEndingInputStream(java.io.InputStream inputStream,
boolean ensureLineFeedAtEndOfFile)
Constructs an input stream that filters another stream
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes the stream.
|
private int |
handleEos(boolean previousWasSlashCr)
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 final boolean lineFeedAtEndOfFile
public UnixLineEndingInputStream(java.io.InputStream inputStream,
boolean ensureLineFeedAtEndOfFile)
inputStream - The input stream to wrapensureLineFeedAtEndOfFile - true to ensure that the file ends with LFpublic void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in class java.io.InputStreamjava.io.IOException - upon errorprivate int handleEos(boolean previousWasSlashCr)
previousWasSlashCr - Indicates if the last seen was a \r.public void mark(int readLimit)
mark in class java.io.InputStreampublic int read()
throws java.io.IOException
read in class java.io.InputStreamjava.io.IOExceptionprivate int readWithUpdate()
throws java.io.IOException
java.io.IOException - upon error