The POI PowerPoint api has a method write(outputstream)
.
But I see S3Client has an api which only accepts an InputStream
to upload files: putObject(bucket, fileKey, inputStream, objectMetadata)
Could someone please suggest the best way to upload the PowerPoint file to s3?
Should I temporarily write on the disk using the
powerpointApi.write(FileOutputStream)
and then upload this file to S3 using theputObject(bucket, fileKey, file)
orputObject(bucket, fileKey, inputStream)
?Or should I write the PowerPoint to
OutputStream
usingpowerpointApi.write(FileOutputStream)
and then convert the output stream to input stream using this accepted answer on stackoverflow (How to upload a Java OutputStream to AWS S3) and then write to s3 usingputObject(bucket, fileKey, inputStream)
?
Also could someone please explain the pros and cons of both these approaches?
Also if someone has better solution please help.