Interface ErrorPropagatingOutputStream
-
- All Known Implementing Classes:
FastPipedOutputStream
,Pipe
public interface ErrorPropagatingOutputStream
OutputStream
that's connected to anInputStream
somewhere, which provides ability to haveInputStream
report an error.- Since:
- 2.35
- Author:
- Kohsuke Kawaguchi
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
error(Throwable e)
Closes the stream and causes the readingInputStream
to report an error.
-
-
-
Method Detail
-
error
void error(@CheckForNull Throwable e) throws IOException
Closes the stream and causes the readingInputStream
to report an error.This method is somewhat like
OutputStream.close()
, in that it signals the end of a stream. In addition to what the close method does, this method will cause theInputStream.read()
method (or any other overloaded versions) to throw anIOException
with the given throwable as the cause.InputStream
will report an error only after all the data that has written before is read. IOW, the error will not magically jump over the data that was written.This is useful to propagate error over a pipe. If used over a channel with the remoting library that doesn't yet support this, or if the
OutputStream
isn't connecting to anInputStream
, this method behaves exactly likeOutputStream.close()
.If
OutputStream
is already closed or error state is set, this method will be no-op.- Parameters:
e
- if null, this method behaves exactly likeOutputStream.close()
- Throws:
IOException
-
-