master
Arjen Poutsma 9 years ago
parent ef58fdcd7b
commit a8f27af5fb
  1. 8
      spring-web-reactive/src/main/java/org/springframework/core/codec/support/ByteBufferEncoder.java

@ -47,12 +47,8 @@ public class ByteBufferEncoder extends AbstractEncoder<ByteBuffer> {
public Flux<DataBuffer> encode(Publisher<? extends ByteBuffer> inputStream, public Flux<DataBuffer> encode(Publisher<? extends ByteBuffer> inputStream,
DataBufferAllocator allocator, ResolvableType type, MimeType mimeType, DataBufferAllocator allocator, ResolvableType type, MimeType mimeType,
Object... hints) { Object... hints) {
//noinspection unchecked
return Flux.from(inputStream).map(byteBuffer -> { return Flux.from(inputStream).map(allocator::wrap);
DataBuffer dataBuffer = allocator.allocateBuffer(byteBuffer.remaining());
dataBuffer.write(byteBuffer);
return dataBuffer;
});
} }
} }
Loading…
Cancel
Save