Package org.eclipse.jgit.util.io
Class BinaryHunkOutputStream
- java.lang.Object
-
- java.io.OutputStream
-
- org.eclipse.jgit.util.io.BinaryHunkOutputStream
-
- All Implemented Interfaces:
java.io.Closeable
,java.io.Flushable
,java.lang.AutoCloseable
public class BinaryHunkOutputStream extends java.io.OutputStream
AnOutputStream
that encodes data for a git binary patch.- Since:
- 5.12
-
-
Constructor Summary
Constructors Constructor Description BinaryHunkOutputStream(java.io.OutputStream out)
Creates a newBinaryHunkOutputStream
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Flushes and closes this stream, and closes the underlyingOutputStream
.private void
encode(byte[] data, int off, int length)
void
flush()
Writes any buffered output as a binary patch line to the underlyingOutputStream
and flushes that stream, too.void
write(byte[] b, int off, int len)
void
write(int b)
-
-
-
Field Detail
-
MAX_BYTES
private static final int MAX_BYTES
- See Also:
- Constant Field Values
-
out
private final java.io.OutputStream out
-
buffer
private final byte[] buffer
-
pos
private int pos
-
-
Constructor Detail
-
BinaryHunkOutputStream
public BinaryHunkOutputStream(java.io.OutputStream out)
Creates a newBinaryHunkOutputStream
.- Parameters:
out
-OutputStream
to write the encoded data to
-
-
Method Detail
-
close
public void close() throws java.io.IOException
Flushes and closes this stream, and closes the underlyingOutputStream
.- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Overrides:
close
in classjava.io.OutputStream
- Throws:
java.io.IOException
-
flush
public void flush() throws java.io.IOException
Writes any buffered output as a binary patch line to the underlyingOutputStream
and flushes that stream, too.- Specified by:
flush
in interfacejava.io.Flushable
- Overrides:
flush
in classjava.io.OutputStream
- Throws:
java.io.IOException
-
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, int off, int len) throws java.io.IOException
- Overrides:
write
in classjava.io.OutputStream
- Throws:
java.io.IOException
-
encode
private void encode(byte[] data, int off, int length) throws java.io.IOException
- Throws:
java.io.IOException
-
-