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 intprivate int(package private) static final intprivate booleanprivate booleanprivate 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- anOutputStreamobject.
-
AutoLFOutputStream
Constructor for AutoLFOutputStream.- Parameters:
out- anOutputStreamobject.detectBinary- whether binaries should be detected
-
-
Method Details
-
write
- Specified by:
writein classOutputStream- Throws:
IOException
-
write
- Overrides:
writein classOutputStream- Throws:
IOException
-
write
- Overrides:
writein classOutputStream- Throws:
IOException
-
buffer
- Throws:
IOException
-
decideMode
- Throws:
IOException
-
flush
- Specified by:
flushin interfaceFlushable- Overrides:
flushin classOutputStream- Throws:
IOException
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classOutputStream- Throws:
IOException
-