Package org.eclipse.jgit.util.io
Class AutoCRLFInputStream
- java.lang.Object
-
- java.io.InputStream
-
- org.eclipse.jgit.util.io.AutoCRLFInputStream
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable
public class AutoCRLFInputStream extends java.io.InputStreamAn InputStream that expands LF to CRLF. Existing CRLF are not expanded to CRCRLF, but retained as is. Optionally, a binary check on the first 8000 bytes is performed and in case of binary files, canonicalization is turned off (for the complete file).
-
-
Field Summary
Fields Modifier and Type Field Description private byte[]buf(package private) static intBUFFER_SIZEprivate intcntprivate booleandetectBinaryprivate java.io.InputStreaminprivate booleanisBinaryprivate bytelastprivate intptrprivate byte[]single
-
Constructor Summary
Constructors Constructor Description AutoCRLFInputStream(java.io.InputStream in, boolean detectBinary)Creates a new InputStream, wrapping the specified stream
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()private booleanfillBuffer()intread()intread(byte[] bs, int off, int len)
-
-
-
Field Detail
-
BUFFER_SIZE
static final int BUFFER_SIZE
- See Also:
- Constant Field Values
-
single
private final byte[] single
-
buf
private final byte[] buf
-
in
private final java.io.InputStream in
-
cnt
private int cnt
-
ptr
private int ptr
-
isBinary
private boolean isBinary
-
detectBinary
private boolean detectBinary
-
last
private byte last
-
-
Method Detail
-
read
public int read() throws java.io.IOException- Specified by:
readin classjava.io.InputStream- Throws:
java.io.IOException
-
read
public int read(byte[] bs, int off, int len) throws java.io.IOException- Overrides:
readin classjava.io.InputStream- Throws:
java.io.IOException
-
close
public void close() throws java.io.IOException- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Overrides:
closein classjava.io.InputStream- Throws:
java.io.IOException
-
fillBuffer
private boolean fillBuffer() throws java.io.IOException- Throws:
java.io.IOException
-
-