Hi all,
I found myself passing InputStream/OutputStream objects around my application modules.
I'm wondering if it's better to
- save the content to disk and pass something like a Resource between the various methods calls
- use a byte[] array
instead of having to deal with streams everytime.
What's your approach in these situations?
Thanks
Edit:
I've a Controller that receives a file uploaded by the user. I've an utility module that provides some functionality to render a file.
utilityMethod(InputStream is, OutputStream os)
The file in InputStream is the one uploaded by the user. os is the stream associated with the response. I'm wondering if it's better to have the utility method to save the generated file in a .tmp file and return the file path, or a byte[], etc. and have the controller to deal with the outputStream directly.