Package org.eclipse.jgit.util.io
Class AutoLFOutputStream
java.lang.Object
java.io.OutputStream
org.eclipse.jgit.util.io.AutoLFOutputStream
- All Implemented Interfaces:
Closeable
,Flushable
,AutoCloseable
An OutputStream that reduces CRLF to LF.
Existing single CR are not changed to LF, but retained as is.
A binary check on the first 8000 bytes is performed and in case of binary files, canonicalization is turned off (for the complete file). If the binary check determines that the input is not binary but text with CR/LF, canonicalization is also turned off.
- Since:
- 4.3
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate byte[]
private int
private int
(package private) static final int
private boolean
private boolean
private byte[]
private final OutputStream
-
Constructor Summary
ConstructorsConstructorDescriptionConstructor for AutoLFOutputStream.AutoLFOutputStream
(OutputStream out, boolean detectBinary) Constructor for AutoLFOutputStream. -
Method Summary
-
Field Details
-
BUFFER_SIZE
static final int BUFFER_SIZE- See Also:
-
out
-
buf
private int buf -
binbuf
private byte[] binbuf -
onebytebuf
private byte[] onebytebuf -
binbufcnt
private int binbufcnt -
detectBinary
private boolean detectBinary -
isBinary
private boolean isBinary
-
-
Constructor Details
-
AutoLFOutputStream
Constructor for AutoLFOutputStream.- Parameters:
out
- anOutputStream
object.
-
AutoLFOutputStream
Constructor for AutoLFOutputStream.- Parameters:
out
- anOutputStream
object.detectBinary
- whether binaries should be detected
-
-
Method Details
-
write
- Specified by:
write
in classOutputStream
- Throws:
IOException
-
write
- Overrides:
write
in classOutputStream
- Throws:
IOException
-
write
- Overrides:
write
in classOutputStream
- Throws:
IOException
-
buffer
- Throws:
IOException
-
decideMode
- Throws:
IOException
-
flush
- Specified by:
flush
in interfaceFlushable
- Overrides:
flush
in classOutputStream
- Throws:
IOException
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classOutputStream
- Throws:
IOException
-