Package: groovy.http

## [Groovy] Class HttpStreamResult.MappingSubscriber

- groovy.http.HttpStreamResult.MappingSubscriber

- All Implemented Interfaces and Traits:
    Flow.Subscriber<Object>

      static final class HttpStreamResult.MappingSubscriber
      extends Object
      implements Flow.Subscriber<Object>

  Subscriber that applies a mapping closure before forwarding items downstream.

  Since:
    6.0.0

- - ### Constructor Summary

    Constructors
    Constructor and description
    `MappingSubscriber(Flow.Subscriber<? super Object> downstream, Closure mapper)` Creates a subscriber that maps upstream items before forwarding them.

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `void` | `onComplete()` Completes downstream once the upstream publisher completes.
    `` | `void` | `onError(Throwable t)` Forwards the terminal error unless this subscriber has already completed.
    `` | `void` | `onNext(Object item)` Maps the upstream item before emitting it downstream.
    `` | `void` | `onSubscribe(Subscription s)` Stores the upstream subscription and forwards it downstream unchanged.

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class Object` | `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### MappingSubscriber(Flow.Subscriber<? super Object> downstream, Closure mapper)

      Creates a subscriber that maps upstream items before forwarding them.

      Parameters:
        `downstream` - the subscriber receiving mapped items
        `mapper` - the mapping closure

  - ### Method Detail

    - #### @Override
      void onComplete()

      Completes downstream once the upstream publisher completes.

    - #### @Override
      void onError(Throwable t)

      Forwards the terminal error unless this subscriber has already completed.

      Parameters:
        `t` - the terminal failure

    - #### @Override
      void onNext(Object item)

      Maps the upstream item before emitting it downstream.

      Parameters:
        `item` - the upstream item

    - #### @Override
      void onSubscribe(Subscription s)

      Stores the upstream subscription and forwards it downstream unchanged.

      Parameters:
        `s` - the upstream subscription