Skip to content

Expose zero-copy file transfer in Servlet API #539

@poutsma

Description

@poutsma

It would be nice if the Servlet spec would expose zero-copy file transfer operations, so that files can be written to the network socket without involving the CPU. In Java, zero-copy is exposed through the FileChannel::transferTo methods, but combing this channel-based API with the Servlet spec seems impossible.

For instance, this could take the form of a long transfer(Path file, long pos, long count) method on either ServletResponse or ServletOutputStream, that takes the file path, position and byte count, and returns the bytes written.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions