- java.lang.Object
-
- java.io.OutputStream
-
- org.eclipse.jgit.transport.SideBandOutputStream
-
- All Implemented Interfaces:
Closeable,Flushable,AutoCloseable
public class SideBandOutputStream extends OutputStream
Multiplexes data and progress messages.This stream is buffered at packet sizes, so the caller doesn't need to wrap it in yet another buffered stream.
- Since:
- 2.0
-
-
Field Summary
Fields Modifier and Type Field Description static intCH_DATAChannel used for pack data.static intCH_ERRORChannel used for error messages.static intCH_PROGRESSChannel used for progress messages.static intMAX_BUFMaximum buffer size for a single packet of sideband data.static intSMALL_BUFDefault buffer size for a small amount of data.
-
Constructor Summary
Constructors Constructor Description SideBandOutputStream(int chan, int sz, OutputStream os)Create a new stream to write side band packets.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidflush()voidwrite(byte[] b, int off, int len)voidwrite(int b)-
Methods inherited from class java.io.OutputStream
close, nullOutputStream, write
-
-
-
-
Field Detail
-
CH_DATA
public static final int CH_DATA
Channel used for pack data.- See Also:
- Constant Field Values
-
CH_PROGRESS
public static final int CH_PROGRESS
Channel used for progress messages.- See Also:
- Constant Field Values
-
CH_ERROR
public static final int CH_ERROR
Channel used for error messages.- See Also:
- Constant Field Values
-
SMALL_BUF
public static final int SMALL_BUF
Default buffer size for a small amount of data.- See Also:
- Constant Field Values
-
MAX_BUF
public static final int MAX_BUF
Maximum buffer size for a single packet of sideband data.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
SideBandOutputStream
public SideBandOutputStream(int chan, int sz, OutputStream os)Create a new stream to write side band packets.- Parameters:
chan- channel number to prefix all packets with, so the remote side can demultiplex the stream and get back the original data. Must be in the range [1, 255].sz- maximum size of a data packet within the stream. The remote side needs to agree to the packet size to prevent buffer overflows. Must be in the range [HDR_SIZE + 1, MAX_BUF).os- stream that the packets are written onto. This stream should be attached to a SideBandInputStream on the remote side.
-
-
Method Detail
-
flush
public void flush() throws IOException- Specified by:
flushin interfaceFlushable- Overrides:
flushin classOutputStream- Throws:
IOException
-
write
public void write(byte[] b, int off, int len) throws IOException- Overrides:
writein classOutputStream- Throws:
IOException
-
write
public void write(int b) throws IOException- Specified by:
writein classOutputStream- Throws:
IOException
-
-