Reputation: 26878
Is it needed to close the passed in InputStream on the putObject
method of the Amazon Java SDK for S3?
Their example only shows usage with a File, but not with an InputStream. The Javadoc also does not indicate if it is needed or not.
Upvotes: 7
Views: 2609
Reputation: 11
In the case of the S3 client, a provided InputStream
is not closed by the call.
The relevant code is S3DataSource.Utils.cleanupDataSource(), which is called in a finally
block for PutObject
and similar calls.
This is a general Java convention, but since it's not documented there's no guarantee that it will remain this way. Perhaps file feedback?
Upvotes: 1