类 OutputStreamPublisher<T>

java.lang.Object
cn.taketoday.http.client.OutputStreamPublisher<T>
类型参数:
T - the published item type
所有已实现的接口:
Flow.Publisher<T>

final class OutputStreamPublisher<T> extends Object implements Flow.Publisher<T>
Bridges between OutputStream and Flow.Publisher<T>.
从以下版本开始:
4.0
作者:
Oleh Dokuka, Arjen Poutsma, Harry Yang
另请参阅:
  • 字段详细资料

  • 构造器详细资料

  • 方法详细资料

    • create

      public static <T> Flow.Publisher<T> create(OutputStreamPublisher.OutputStreamHandler outputStreamHandler, OutputStreamPublisher.ByteMapper<T> byteMapper, Executor executor)
      Creates a new Publisher<T> based on bytes written to a OutputStream. The parameter byteMapper is used to map from written bytes to the published type.
      • The parameter outputStreamHandler is invoked once per subscription of the returned Publisher, when the first item is requested.
      • OutputStream.write() invocations made by outputStreamHandler are buffered until they exceed the default chunk size of 1024, and then result in a published item if there is demand.
      • If there is no demand, OutputStream.write() will block until there is.
      • If the subscription is cancelled, OutputStream.write() will throw a IOException.
      • The subscription is completed when outputStreamHandler completes.
      • Any IOExceptions thrown from outputStreamHandler will be dispatched to the Subscriber.
      类型参数:
      T - the publisher type
      参数:
      outputStreamHandler - invoked when the first buffer is requested
      byteMapper - maps written bytes to T
      executor - used to invoke the outputStreamHandler
      返回:
      a Publisher<T> based on bytes written by outputStreamHandler mapped by byteMapper
    • create

      public static <T> Flow.Publisher<T> create(OutputStreamPublisher.OutputStreamHandler outputStreamHandler, OutputStreamPublisher.ByteMapper<T> byteMapper, Executor executor, int chunkSize)
      Creates a new Publisher<T> based on bytes written to a OutputStream. The parameter byteMapper is used to map from written bytes to the published type.
      • The parameter outputStreamHandler is invoked once per subscription of the returned Publisher, when the first item is requested.
      • OutputStream.write() invocations made by outputStreamHandler are buffered until they exceed chunkSize, and then result in a published item if there is demand.
      • If there is no demand, OutputStream.write() will block until there is.
      • If the subscription is cancelled, OutputStream.write() will throw a IOException.
      • The subscription is completed when outputStreamHandler completes.
      • Any IOExceptions thrown from outputStreamHandler will be dispatched to the Subscriber.
      类型参数:
      T - the publisher type
      参数:
      outputStreamHandler - invoked when the first buffer is requested
      byteMapper - maps written bytes to T
      executor - used to invoke the outputStreamHandler
      返回:
      a Publisher<T> based on bytes written by outputStreamHandler mapped by byteMapper
    • subscribe

      public void subscribe(Flow.Subscriber<? super T> subscriber)
      指定者:
      subscribe 在接口中 Flow.Publisher<T>