Polishing.

This commit is contained in:
Arjen Poutsma 2016-03-31 11:52:03 +02:00
parent ef58fdcd7b
commit a8f27af5fb
1 changed files with 2 additions and 6 deletions

View File

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