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 int
private 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
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
- 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
-