Q:

Scala & Finatra: send file server response directly from disk to network w/o loading into memory

I was tasked at work to send our clients a file via finatra, directly from disk without loading into memory(these are very large files). Here are my questions:
0) How do I interact with the disk i/o without ever loading the information into memory?
1) When connecting a file inputstream to an http outputstream, does that actually load memory into ram?
2) I thought everything has to be loaded into memory to work with, transport, and send. How can one actually send contents directly to a network port w/o being loaded into memory?
3) Would the flow of memory be from the disk, to the cpu registers, onto network adapters buffer for it to be sent? How do I ensure that this is the flow without loading ram?
4) Is it possible to do this in Finatra

A:

It's unfortunately not possible with Finatra 1.6. Streaming seems to be on the roadmap for 2.0, but there is no official word on its release. Right now, Request => Response relies on memorized inputs and outputs. The most efficient way to deal with bodies in Finatra is to keep them in ChannelBuffers so that there is at least only one instance of the bytes materialized.

