Package io.servicetalk.oio.api
Interface PayloadWriter<T>
- Type Parameters:
T- The type of Objects to write.
- All Superinterfaces:
AutoCloseable,Closeable,Flushable
- All Known Subinterfaces:
GrpcPayloadWriter<T>,HttpPayloadWriter<T>
- All Known Implementing Classes:
ConnectablePayloadWriter
An interface which mimics behavior like
OutputStream, but allows for writing of objects of type
PayloadWriter.-
Method Summary
Modifier and TypeMethodDescriptionvoidThis method shares the same characteristics asCloseable.close()but propagatescauseto downstream consumer instead of propagating "successful" completion.voidWrite an object of typePayloadWriter.
-
Method Details
-
write
Write an object of typePayloadWriter.- Parameters:
t- the object to write.- Throws:
IOException- if an I/O error occurs. In particular, anIOExceptionmay be thrown if this has been closed.
-
close
This method shares the same characteristics asCloseable.close()but propagatescauseto downstream consumer instead of propagating "successful" completion. Here are notable characteristics shared withCloseable.close():- Resources are reclaimed
- This method is idempotent
- Subsequent calls to
write(Object)are expected to fail - Before any exception is thrown, all resources must be reclaimed and
causepropagated
- Parameters:
cause- Indicate the close is a result of a failure.- Throws:
IOException- if an input/output error occurs.
-