Below is the upload request saved in a file. In runtime I need read the file and replace the placeholder {{stream}} to inputstream data(stream data of a file which I need to upload)

```
--Content Boundary
Content-Disposition: form-data; name="metadata"
Content-Type: application/json; charset=US-ASCII
Content-Transfer-Encoding: 8bit

{"id":"docupload","body":{"file":[{}]}}

--Content Boundary
Content-Disposition: form-data; name="inputFile"; filename="file1.xlsx"
Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
Content-Transfer-Encoding: binary

{{stream}}
--Content Boundary--

```

I used below method to convert upload file stream of data to string and then I will replace in placeholder,

```
 ByteArrayOutputStream bos = new ByteArrayOutputStream();             
 workbook.write(bos); // workbook is instance of XSSFWorkbook which I used to create at runtime
 return new String(bos.toByteArray(), StandardCharsets.UTF_8);

```

But when I try to download Im getting corrupted file. Help me with the process which Im doing wrongly. Thanks in advance