public class IsolatedOutputStream extends OutputStream
Wraps an OutputStream to prevent interrupts during writes from being made visible to that stream instance. This works around buggy or difficult OutputStream implementations like JSch that cannot gracefully handle an interrupt during write.
Every write (or flush) requires a context switch to another thread. Callers
should wrap this stream with BufferedOutputStream
using a suitable
buffer size to amortize the cost of context switches.
Constructor and Description |
---|
IsolatedOutputStream(OutputStream out)
Wraps an OutputStream.
|
Modifier and Type | Method and Description |
---|---|
void |
close() |
void |
flush() |
void |
write(byte[] buf,
int pos,
int cnt) |
void |
write(int ch) |
write
public IsolatedOutputStream(OutputStream out)
out
- stream to send all writes to.public void write(int ch) throws IOException
write
in class OutputStream
IOException
public void write(byte[] buf, int pos, int cnt) throws IOException
write
in class OutputStream
IOException
public void flush() throws IOException
flush
in interface Flushable
flush
in class OutputStream
IOException
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in class OutputStream
IOException
Copyright © 2018 Eclipse JGit Project. All rights reserved.