title: How to correctly read Flux<DataBuffer> and convert it to a single inputStream
body: <p>I'm using <code>WebClient</code> and custom <code>BodyExtractor</code>class for my spring-boot application</p>
  
  <pre><code>WebClient webLCient = WebClient.create();
  webClient.get()
     .uri(url, params)
     .accept(MediaType.APPLICATION.XML)
     .exchange()
     .flatMap(response -&gt; {
       return response.body(new BodyExtractor());
     })
  </code></pre>
  
  <p>BodyExtractor.java</p>
  
  <pre><code>@Override
  public Mono&lt;T&gt; extract(ClientHttpResponse response, BodyExtractor.Context context) {
    Flux&lt;DataBuffer&gt; body = response.getBody();
    body.map(dataBuffer -&gt; {
      try {
        JaxBContext jc = JaxBContext.newInstance(SomeClass.class);
        Unmarshaller unmarshaller = jc.createUnmarshaller();
  
        return (T) unmarshaller.unmarshal(dataBuffer.asInputStream())
      } catch(Exception e){
         return null;
      }
    }).next();
  }
  </code></pre>
  
  <p>Above code works with small payload but not on a large payload, I think it's because I'm only reading a single flux value with <code>next</code> and I'm not sure how to combine and read all <code>dataBuffer</code>.</p>
  
  <p>I'm new to reactor, so I don't know a lot of tricks with flux/mono.</p>