title: How to forward large files with RestTemplate?
body: <p>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. </p>
  
  <pre><code>Resource zipFile = new FileSystemResource(tempFile.getAbsolutePath());
  </code></pre>
  
  <p>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.</p>
  
  <pre><code>ByteArrayResource r = new ByteArrayResource(inputStream.getBytes());
  </code></pre>
  
  <p>Any solutions to forwarding files without getting an OutOfMemory error using RestTemplate? </p>