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.OutputStreamAnOutputStreamthat 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 voidclose()Flushes and closes this stream, and closes the underlyingOutputStream.private voidencode(byte[] data, int off, int length)voidflush()Writes any buffered output as a binary patch line to the underlyingOutputStreamand flushes that stream, too.voidwrite(byte[] b, int off, int len)voidwrite(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-OutputStreamto write the encoded data to
-
-
Method Detail
-
close
public void close() throws java.io.IOExceptionFlushes and closes this stream, and closes the underlyingOutputStream.- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Overrides:
closein classjava.io.OutputStream- Throws:
java.io.IOException
-
flush
public void flush() throws java.io.IOExceptionWrites any buffered output as a binary patch line to the underlyingOutputStreamand flushes that stream, too.- Specified by:
flushin interfacejava.io.Flushable- Overrides:
flushin classjava.io.OutputStream- Throws:
java.io.IOException
-
write
public void write(int b) throws java.io.IOException- Specified by:
writein classjava.io.OutputStream- Throws:
java.io.IOException
-
write
public void write(byte[] b, int off, int len) throws java.io.IOException- Overrides:
writein 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
-
-