public static ByteBufFlux fromPath(Path path,
			int maxChunkSize,
			ByteBufAllocator allocator) {
		Objects.requireNonNull(path, "path");
		Objects.requireNonNull(allocator, "allocator");
		if (maxChunkSize < 1) {
			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 {
				if (buf.writeBytes(fc, maxChunkSize) < 0) {
					buf.release();
					sink.complete();
				}
				else {
					sink.next(buf);
				}
			}
			catch (IOException e) {
				buf.release();
				sink.error(e);
			}
			return fc;
		}), allocator);
	}
public static ByteBufFlux fromPath ( Path path , int maxChunkSize , ByteBufAllocator allocator ) { Objects . requireNonNull ( path , "path" ) ; Objects . requireNonNull ( allocator , "allocator" ) ; if ( maxChunkSize < 1 ) { 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 { if ( buf . writeBytes ( fc , maxChunkSize ) < 0 ) { buf . release ( ) ; sink . complete ( ) ; } else { sink . next ( buf ) ; } } catch ( IOException e ) { buf . release ( ) ; sink . error ( e ) ; } return fc ; } ) , allocator ) ; }
Open a {@link java.nio.channels.FileChannel} from a path and stream
{@link ByteBuf} chunks with a given maximum size into the returned
{@link ByteBufFlux}, using the provided {@link ByteBufAllocator}.

@param path the path to the resource to stream
@param maxChunkSize the maximum per-item ByteBuf size
@param allocator the channel {@link ByteBufAllocator}

@return a {@link ByteBufFlux}