List of usage examples for com.amazonaws RequestClientOptions DEFAULT_STREAM_BUFFER_SIZE
int DEFAULT_STREAM_BUFFER_SIZE
To view the source code for com.amazonaws RequestClientOptions DEFAULT_STREAM_BUFFER_SIZE.
Click Source Link
From source file:org.eclipse.hawkbit.artifact.repository.S3Repository.java
License:Open Source License
private DbArtifact store(final String sha1Hash16, final String mdMD5Hash16, final String contentType, final File file, final DbArtifactHash hash) { final S3Artifact s3Artifact = createS3Artifact(sha1Hash16, mdMD5Hash16, contentType, file); checkHashes(s3Artifact, hash);/*from ww w. j a va 2s.co m*/ LOG.info("Storing file {} with length {} to AWS S3 bucket {} as SHA1 {}", file.getName(), file.length(), s3Properties.getBucketName(), sha1Hash16); if (exists(sha1Hash16)) { LOG.debug("Artifact {} already exists on S3 bucket {}, don't need to upload twice", sha1Hash16, s3Properties.getBucketName()); return s3Artifact; } try (final InputStream inputStream = new BufferedInputStream(new FileInputStream(file), RequestClientOptions.DEFAULT_STREAM_BUFFER_SIZE)) { final ObjectMetadata objectMetadata = createObjectMetadata(mdMD5Hash16, contentType, file); amazonS3.putObject(s3Properties.getBucketName(), sha1Hash16, inputStream, objectMetadata); return s3Artifact; } catch (final IOException | AmazonClientException e) { throw new ArtifactStoreException(e.getMessage(), e); } }