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

public interface PayloadWriter<T> extends Closeable, Flushable
An interface which mimics behavior like OutputStream, but allows for writing of objects of type PayloadWriter.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    This method shares the same characteristics as Closeable.close() but propagates cause to downstream consumer instead of propagating "successful" completion.
    void
    write(T t)
    Write an object of type PayloadWriter.

    Methods inherited from interface java.io.Closeable

    close

    Methods inherited from interface java.io.Flushable

    flush
  • Method Details

    • write

      void write(T t) throws IOException
      Write an object of type PayloadWriter.
      Parameters:
      t - the object to write.
      Throws:
      IOException - if an I/O error occurs. In particular, an IOException may be thrown if this has been closed.
    • close

      void close(Throwable cause) throws IOException
      This method shares the same characteristics as Closeable.close() but propagates cause to downstream consumer instead of propagating "successful" completion. Here are notable characteristics shared with Closeable.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 cause propagated
      Parameters:
      cause - Indicate the close is a result of a failure.
      Throws:
      IOException - if an input/output error occurs.