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.InputStream
An 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 int
BUFFER_SIZE
private int
cnt
private boolean
detectBinary
private java.io.InputStream
in
private boolean
isBinary
private byte
last
private int
ptr
private 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 void
close()
private boolean
fillBuffer()
int
read()
int
read(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:
read
in classjava.io.InputStream
- Throws:
java.io.IOException
-
read
public int read(byte[] bs, int off, int len) throws java.io.IOException
- Overrides:
read
in classjava.io.InputStream
- Throws:
java.io.IOException
-
close
public void close() throws java.io.IOException
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Overrides:
close
in classjava.io.InputStream
- Throws:
java.io.IOException
-
fillBuffer
private boolean fillBuffer() throws java.io.IOException
- Throws:
java.io.IOException
-
-