@@ -357,6 +357,18 @@ default Future<Void> sendFile(String filename) {
357357 return sendFile (filename , 0 );
358358 }
359359
360+ /**
361+ * Same as {@link #sendFile(String, long, long, SendFileOptions)} with offset {@code 0} and length
362+ * {@code Long.MAX_VALUE} which means until the end of the file.
363+ *
364+ * @param filename path to the file to serve
365+ * @param options send-file options
366+ * @return a future completed with the body result
367+ */
368+ default Future <Void > sendFile (String filename , SendFileOptions options ) {
369+ return sendFile (filename , 0 , options );
370+ }
371+
360372 /**
361373 * Same as {@link #sendFile(String, long, long)} using length @code{Long.MAX_VALUE} which means until the end of the
362374 * file.
@@ -373,6 +385,19 @@ default Future<Void> sendFile(String filename, long offset) {
373385 return sendFile (filename , offset , Long .MAX_VALUE );
374386 }
375387
388+ /**
389+ * Same as {@link #sendFile(String, long, long, SendFileOptions)} using length {@code Long.MAX_VALUE}
390+ * which means until the end of the file.
391+ *
392+ * @param filename path to the file to serve
393+ * @param offset offset to start serving from
394+ * @param options send-file options
395+ * @return a future completed with the body result
396+ */
397+ default Future <Void > sendFile (String filename , long offset , SendFileOptions options ) {
398+ return sendFile (filename , offset , Long .MAX_VALUE , options );
399+ }
400+
376401 /**
377402 * Ask the OS to stream a file as specified by {@code filename} directly
378403 * from disk to the outgoing connection, bypassing userspace altogether
@@ -391,6 +416,22 @@ default Future<Void> sendFile(String filename, long offset) {
391416 */
392417 Future <Void > sendFile (String filename , long offset , long length );
393418
419+ /**
420+ * Same as {@link #sendFile(String, long, long)} with send-file options.
421+ * <p>
422+ * {@link SendFileOptions#getChunkSize()} configures the chunk size used by the fallback streaming path.
423+ * It is ignored when the file-region/sendfile path is used.
424+ *
425+ * @param filename path to the file to serve
426+ * @param offset offset to start serving from
427+ * @param length the number of bytes to send
428+ * @param options send-file options
429+ * @return a future completed with the body result
430+ */
431+ default Future <Void > sendFile (String filename , long offset , long length , SendFileOptions options ) {
432+ return sendFile (filename , offset , length );
433+ }
434+
394435 /**
395436 * Same as {@link #sendFile(FileChannel, long)} using length @code{Long.MAX_VALUE} which means until the end of the
396437 * file.
@@ -408,6 +449,20 @@ default Future<Void> sendFile(FileChannel channel) {
408449 return sendFile (channel , 0 );
409450 }
410451
452+ /**
453+ * Same as {@link #sendFile(FileChannel, long, long, SendFileOptions)} with offset {@code 0} and length
454+ * {@code Long.MAX_VALUE} which means until the end of the file.
455+ *
456+ * @param channel the file channel to the file to serve
457+ * @param options send-file options
458+ * @return a future completed with the body result
459+ */
460+ @ GenIgnore (GenIgnore .PERMITTED_TYPE )
461+ @ Unstable
462+ default Future <Void > sendFile (FileChannel channel , SendFileOptions options ) {
463+ return sendFile (channel , 0 , options );
464+ }
465+
411466 /**
412467 * Same as {@link #sendFile(FileChannel, long, long)} using length @code{Long.MAX_VALUE} which means until the end of the
413468 * file.
@@ -426,6 +481,21 @@ default Future<Void> sendFile(FileChannel channel, long offset) {
426481 return sendFile (channel , offset , Long .MAX_VALUE );
427482 }
428483
484+ /**
485+ * Same as {@link #sendFile(FileChannel, long, long, SendFileOptions)} using length {@code Long.MAX_VALUE}
486+ * which means until the end of the file.
487+ *
488+ * @param channel the file channel to the file to serve
489+ * @param offset offset to start serving from
490+ * @param options send-file options
491+ * @return a future completed with the body result
492+ */
493+ @ GenIgnore (GenIgnore .PERMITTED_TYPE )
494+ @ Unstable
495+ default Future <Void > sendFile (FileChannel channel , long offset , SendFileOptions options ) {
496+ return sendFile (channel , offset , Long .MAX_VALUE , options );
497+ }
498+
429499 /**
430500 * Ask the OS to stream a file as specified by {@code channel} directly
431501 * from disk to the outgoing connection, bypassing userspace altogether
@@ -449,6 +519,24 @@ default Future<Void> sendFile(FileChannel channel, long offset) {
449519 @ Unstable
450520 Future <Void > sendFile (FileChannel channel , long offset , long length );
451521
522+ /**
523+ * Same as {@link #sendFile(FileChannel, long, long)} with send-file options.
524+ * <p>
525+ * {@link SendFileOptions#getChunkSize()} configures the chunk size used by the fallback streaming path.
526+ * It is ignored when the file-region/sendfile path is used.
527+ *
528+ * @param channel the file channel to the file to serve
529+ * @param offset offset to start serving from
530+ * @param length the number of bytes to send
531+ * @param options send-file options
532+ * @return a future completed with the body result
533+ */
534+ @ GenIgnore (GenIgnore .PERMITTED_TYPE )
535+ @ Unstable
536+ default Future <Void > sendFile (FileChannel channel , long offset , long length , SendFileOptions options ) {
537+ return sendFile (channel , offset , length );
538+ }
539+
452540 /**
453541 * Same as {@link #sendFile(FileChannel)} with {@link RandomAccessFile}
454542 * <p>
@@ -465,6 +553,20 @@ default Future<Void> sendFile(RandomAccessFile file) {
465553 return sendFile (file , 0 );
466554 }
467555
556+ /**
557+ * Same as {@link #sendFile(RandomAccessFile, long, long, SendFileOptions)} with offset {@code 0} and length
558+ * {@code Long.MAX_VALUE} which means until the end of the file.
559+ *
560+ * @param file the file to serve
561+ * @param options send-file options
562+ * @return a future completed with the body result
563+ */
564+ @ GenIgnore (GenIgnore .PERMITTED_TYPE )
565+ @ Unstable
566+ default Future <Void > sendFile (RandomAccessFile file , SendFileOptions options ) {
567+ return sendFile (file , 0 , options );
568+ }
569+
468570 /**
469571 *
470572 * Same as {@link #sendFile(FileChannel, long)} with {@link RandomAccessFile}
@@ -483,6 +585,21 @@ default Future<Void> sendFile(RandomAccessFile file, long offset) {
483585 return sendFile (file , offset , Long .MAX_VALUE );
484586 }
485587
588+ /**
589+ * Same as {@link #sendFile(RandomAccessFile, long, long, SendFileOptions)} using length {@code Long.MAX_VALUE}
590+ * which means until the end of the file.
591+ *
592+ * @param file the file to serve
593+ * @param offset offset to start serving from
594+ * @param options send-file options
595+ * @return a future completed with the body result
596+ */
597+ @ GenIgnore (GenIgnore .PERMITTED_TYPE )
598+ @ Unstable
599+ default Future <Void > sendFile (RandomAccessFile file , long offset , SendFileOptions options ) {
600+ return sendFile (file , offset , Long .MAX_VALUE , options );
601+ }
602+
486603 /**
487604 * Same as {@link #sendFile(FileChannel, long, long)} with {@link RandomAccessFile}
488605 * <p>
@@ -499,6 +616,24 @@ default Future<Void> sendFile(RandomAccessFile file, long offset) {
499616 @ Unstable
500617 Future <Void > sendFile (RandomAccessFile file , long offset , long length );
501618
619+ /**
620+ * Same as {@link #sendFile(RandomAccessFile, long, long)} with send-file options.
621+ * <p>
622+ * {@link SendFileOptions#getChunkSize()} configures the chunk size used by the fallback streaming path.
623+ * It is ignored when the file-region/sendfile path is used.
624+ *
625+ * @param file the file to serve
626+ * @param offset offset to start serving from
627+ * @param length the number of bytes to send
628+ * @param options send-file options
629+ * @return a future completed with the body result
630+ */
631+ @ GenIgnore (GenIgnore .PERMITTED_TYPE )
632+ @ Unstable
633+ default Future <Void > sendFile (RandomAccessFile file , long offset , long length , SendFileOptions options ) {
634+ return sendFile (file , offset , length );
635+ }
636+
502637 /**
503638 * @return has the response already ended?
504639 */
0 commit comments