public static void cleanupDataSource(S3DataSource req,
                final File fileOrig, final InputStream inputStreamOrig,
                InputStream inputStreamCurr, Log log) {
            if (fileOrig != null) {
                // We opened a file underneath so would need to release it
                release(inputStreamCurr, log);
            }
            // restore the original input stream so the caller could close
            // it if necessary
            req.setInputStream(inputStreamOrig);
            req.setFile(fileOrig);
        }
Clean up any temporary streams created during the execution,
and restore the original file and/or input stream.
aws-java-sdk-s3/src/main/java/com/amazonaws/services/s3/model/S3DataSource.java