/** * Disable auto memory release on each buffer published, retaining in order to prevent * premature recycling when buffers are accumulated downstream (async). * * @return {@link ByteBufFlux} of retained {@link ByteBuf} */ public ByteBufFlux retain() { return new ByteBufFlux(doOnNext(ByteBuf::retain), alloc); }
/** * Decorate as {@link ByteBufFlux} * * @param source publisher to decorate * @param allocator the channel {@link ByteBufAllocator} * * @return a {@link ByteBufFlux} */ public static ByteBufFlux fromInbound(Publisher<?> source, ByteBufAllocator allocator) { Objects.requireNonNull(allocator, "allocator"); return new ByteBufFlux(Flux.from(source) .map(bytebufExtractor), allocator); }
throw new IllegalArgumentException("chunk size must be strictly positive, " + "was: " + maxChunkSize); return new ByteBufFlux(Flux.generate(() -> FileChannel.open(path), (fc, sink) -> { ByteBuf buf = allocator.buffer(); try {