public class AutoLFInputStream
extends java.io.InputStream
This is the former EolCanonicalizingInputStream with a new name in order to have same naming for all LF / CRLF streams
Modifier and Type | Class and Description |
---|---|
static class |
AutoLFInputStream.IsBinaryException
A special exception thrown when
AutoLFInputStream is told to
throw an exception when attempting to read a binary file. |
Modifier and Type | Field and Description |
---|---|
private boolean |
abortIfBinary |
private byte[] |
buf |
private int |
cnt |
private boolean |
detectBinary |
private java.io.InputStream |
in |
private boolean |
isBinary |
private int |
ptr |
private byte[] |
single |
Constructor and Description |
---|
AutoLFInputStream(java.io.InputStream in,
boolean detectBinary)
Creates a new InputStream, wrapping the specified stream
|
AutoLFInputStream(java.io.InputStream in,
boolean detectBinary,
boolean abortIfBinary)
Creates a new InputStream, wrapping the specified stream
|
Modifier and Type | Method and Description |
---|---|
void |
close() |
private boolean |
fillBuffer() |
boolean |
isBinary()
Whether the stream has detected as a binary so far.
|
int |
read() |
int |
read(byte[] bs,
int off,
int len) |
private final byte[] single
private final byte[] buf
private final java.io.InputStream in
private int cnt
private int ptr
private boolean isBinary
private boolean detectBinary
private boolean abortIfBinary
public AutoLFInputStream(java.io.InputStream in, boolean detectBinary)
in
- raw input streamdetectBinary
- whether binaries should be detectedpublic AutoLFInputStream(java.io.InputStream in, boolean detectBinary, boolean abortIfBinary)
in
- raw input streamdetectBinary
- whether binaries should be detectedabortIfBinary
- throw an IOException if the file is binarypublic int read() throws java.io.IOException
read
in class java.io.InputStream
java.io.IOException
public int read(byte[] bs, int off, int len) throws java.io.IOException
read
in class java.io.InputStream
java.io.IOException
public boolean isBinary()
public 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
private boolean fillBuffer() throws java.io.IOException
java.io.IOException