In my project we are saving some files.
When a file is requested, I fetch the file from the HBase table and then send it to the browser.
Data is saved in Bytes in HBase. So when I fetch the file I am getting it in Bytes.
Now I have to convert these Bytes into either File object or in Output Stream.
What I want to know is whether send the file via a File object is better or Output Stream?
The file can vary from 1 MB to 10 MS’s.
I am using REST API to send data.
Sending a java.io.File object wont help as it would be a very java specific binary object and it will mandate that receiving system is in java.
You mentioned, you are using REST. Now this calls for something which is independent of any technology/platform.
One feasible approach would be as follows.
Here is an example of PDF file download using a servlet .