Package org.eclipse.jgit.util.io
Class AutoCRLFOutputStream
- java.lang.Object
-
- java.io.OutputStream
-
- org.eclipse.jgit.util.io.AutoCRLFOutputStream
-
- All Implemented Interfaces:
java.io.Closeable
,java.io.Flushable
,java.lang.AutoCloseable
public class AutoCRLFOutputStream extends java.io.OutputStream
An OutputStream that expands LF to CRLF. Existing CRLF are not expanded to CRCRLF, but retained as is. A binary check on the firstRawText.getBufferSize()
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[]
binbuf
private int
binbufcnt
private int
buf
private boolean
detectBinary
private boolean
isBinary
private byte[]
onebytebuf
private java.io.OutputStream
out
-
Constructor Summary
Constructors Constructor Description AutoCRLFOutputStream(java.io.OutputStream out)
Constructor for AutoCRLFOutputStream.AutoCRLFOutputStream(java.io.OutputStream out, boolean detectBinary)
Constructor for AutoCRLFOutputStream.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private int
buffer(byte[] b, int off, int len)
void
close()
private void
decideMode(boolean complete)
void
flush()
void
write(byte[] b)
void
write(byte[] b, int startOff, int startLen)
void
write(int b)
-
-
-
Constructor Detail
-
AutoCRLFOutputStream
public AutoCRLFOutputStream(java.io.OutputStream out)
Constructor for AutoCRLFOutputStream.
- Parameters:
out
- aOutputStream
object.
-
AutoCRLFOutputStream
public AutoCRLFOutputStream(java.io.OutputStream out, boolean detectBinary)
Constructor for AutoCRLFOutputStream.
- Parameters:
out
- aOutputStream
object.detectBinary
- whether binaries should be detected- Since:
- 4.3
-
-
Method Detail
-
write
public void write(int b) throws java.io.IOException
- Specified by:
write
in classjava.io.OutputStream
- Throws:
java.io.IOException
-
write
public void write(byte[] b) throws java.io.IOException
- Overrides:
write
in classjava.io.OutputStream
- Throws:
java.io.IOException
-
write
public void write(byte[] b, int startOff, int startLen) throws java.io.IOException
- Overrides:
write
in classjava.io.OutputStream
- Throws:
java.io.IOException
-
buffer
private int buffer(byte[] b, int off, int len) throws java.io.IOException
- Throws:
java.io.IOException
-
decideMode
private void decideMode(boolean complete) throws java.io.IOException
- Throws:
java.io.IOException
-
flush
public void flush() throws java.io.IOException
- Specified by:
flush
in interfacejava.io.Flushable
- Overrides:
flush
in classjava.io.OutputStream
- 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.OutputStream
- Throws:
java.io.IOException
-
-