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) |
writepublic IsolatedOutputStream(OutputStream out)
out - stream to send all writes to.public void write(int ch)
throws IOException
write in class OutputStreamIOExceptionpublic void write(byte[] buf,
int pos,
int cnt)
throws IOException
write in class OutputStreamIOExceptionpublic void flush()
throws IOException
flush in interface Flushableflush in class OutputStreamIOExceptionpublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableclose in class OutputStreamIOExceptionCopyright © 2021 Eclipse JGit Project. All rights reserved.