For files generated in memory, you may use ByteArrayResource. Just convert your InputStream object using IOUtils from the Apache Commons IO library.
It is quite simple:
helper.addAttachment("attachement",
new ByteArrayResource(IOUtils.toByteArray(inputStream)));