yes, but also no! When streaming the data, a file reader will redirect to sendFile, making the writer aware it is dealing with a file.
The allocating writer (made from the array list), when doing sendFile does query and allocate the size of the file. However, the allocation logic will @Bobvan showed is still used, so it can, and does in this case, allocate more than the exact size.
This could be changed to more precisely grow when it has a file size, the code to do this already exists… it just isnt used in this code path.
Its just cause the simplest api path to do this happens to use an arraylist.
This api does not, and should not be, manipulating the contents beyond reading and growing.