I have a web service call through which zip files can be uploaded. The files are then forwarded to another service for storage, unzipping, etc. For now the file is stored on the file system, then a FileSystemResource is built.
Resource zipFile = new FileSystemResource(tempFile.getAbsolutePath());
I could use a ByteStreamResource in order to save time(the saving of the file on disk is not needed before forwarding) but for that i need to build a byte array. In case of large files I will get an "OutOfMemory : java heap space" error.
ByteArrayResource r = new ByteArrayResource(inputStream.getBytes());
Any solutions to forwarding files without getting an OutOfMemory error using RestTemplate?