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 RawText.getBufferSize() 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 intprivate booleanprivate booleanprivate byte[]private final OutputStream -
Constructor Summary
ConstructorsConstructorDescriptionConstructor for AutoLFOutputStream.AutoLFOutputStream(OutputStream out, boolean detectBinary) Constructor for AutoLFOutputStream. -
Method Summary
Methods inherited from class java.io.OutputStream
nullOutputStream
-
Field Details
-
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
-