s3o.setContentLength(file.length()); s3o.setDataInputStream(new BufferedInputStream(new FileInputStream(file))); s3o.setContentType("application/gzip"); try { s3.putObject(bucket, s3o);
inputStream = encryptionUtil.encrypt(inputStream); contentEncoding = null; s3Object.setContentType(Mimetypes.MIMETYPE_OCTET_STREAM); s3Object.addMetadata(Constants.METADATA_JETS3T_CRYPTO_ALGORITHM, encryptionUtil.getAlgorithm());
inputStream = encryptionUtil.encrypt(inputStream); contentEncoding = null; s3Object.setContentType(Mimetypes.MIMETYPE_OCTET_STREAM); s3Object.addMetadata(Constants.METADATA_JETS3T_CRYPTO_ALGORITHM, encryptionUtil.getAlgorithm());
@Override public void storeEmptyFile(String key) throws IOException { try { S3Object object = new S3Object(key); object.setDataInputStream(new ByteArrayInputStream(new byte[0])); object.setContentType("binary/octet-stream"); object.setContentLength(0); object.setServerSideEncryptionAlgorithm(serverSideEncryptionAlgorithm); s3Service.putObject(bucket, object); } catch (ServiceException e) { handleException(e, key); } }
public void storeFile(String key, File file, byte[] md5Hash) throws IOException { BufferedInputStream in = null; try { in = new BufferedInputStream(new FileInputStream(file)); S3Object object = new S3Object(key); object.setDataInputStream(in); object.setContentType("binary/octet-stream"); object.setContentLength(file.length()); if (md5Hash != null) { object.setMd5Hash(md5Hash); } s3Service.putObject(bucket, object); } catch (S3ServiceException e) { if (e.getCause() instanceof IOException) { throw (IOException) e.getCause(); } throw new S3Exception(e); } finally { if (in != null) { try { in.close(); } catch (IOException e) { // ignore } } } }
public void storeFile(String key, File file, byte[] md5Hash) throws IOException { BufferedInputStream in = null; try { in = new BufferedInputStream(new FileInputStream(file)); S3Object object = new S3Object(key); object.setDataInputStream(in); object.setContentType("binary/octet-stream"); object.setContentLength(file.length()); if (md5Hash != null) { object.setMd5Hash(md5Hash); } s3Service.putObject(bucket, object); } catch (S3ServiceException e) { if (e.getCause() instanceof IOException) { throw (IOException) e.getCause(); } throw new S3Exception(e); } finally { if (in != null) { try { in.close(); } catch (IOException e) { // ignore } } } }
@Override public void storeFile(String key, File file, byte[] md5Hash) throws IOException { if (multipartEnabled && file.length() >= multipartBlockSize) { storeLargeFile(key, file, md5Hash); return; } BufferedInputStream in = null; try { in = new BufferedInputStream(new FileInputStream(file)); S3Object object = new S3Object(key); object.setDataInputStream(in); object.setContentType("binary/octet-stream"); object.setContentLength(file.length()); object.setServerSideEncryptionAlgorithm(serverSideEncryptionAlgorithm); if (md5Hash != null) { object.setMd5Hash(md5Hash); } s3Service.putObject(bucket, object); } catch (ServiceException e) { handleException(e, key); } finally { IOUtils.closeStream(in); } }
public void storeEmptyFile(String key) throws IOException { try { S3Object object = new S3Object(key); object.setDataInputStream(new ByteArrayInputStream(new byte[0])); object.setContentType("binary/octet-stream"); object.setContentLength(0); s3Service.putObject(bucket, object); } catch (S3ServiceException e) { if (e.getCause() instanceof IOException) { throw (IOException) e.getCause(); } throw new S3Exception(e); } }
public void storeEmptyFile(String key) throws IOException { try { S3Object object = new S3Object(key); object.setDataInputStream(new ByteArrayInputStream(new byte[0])); object.setContentType("binary/octet-stream"); object.setContentLength(0); s3Service.putObject(bucket, object); } catch (S3ServiceException e) { if (e.getCause() instanceof IOException) { throw (IOException) e.getCause(); } throw new S3Exception(e); } }
public void storeLargeFile(String key, File file, byte[] md5Hash) throws IOException { S3Object object = new S3Object(key); object.setDataInputFile(file); object.setContentType("binary/octet-stream"); object.setContentLength(file.length()); object.setServerSideEncryptionAlgorithm(serverSideEncryptionAlgorithm); if (md5Hash != null) { object.setMd5Hash(md5Hash); } List<StorageObject> objectsToUploadAsMultipart = new ArrayList<StorageObject>(); objectsToUploadAsMultipart.add(object); MultipartUtils mpUtils = new MultipartUtils(multipartBlockSize); try { mpUtils.uploadObjects(bucket.getName(), s3Service, objectsToUploadAsMultipart, null); } catch (Exception e) { handleException(e, key); } }
s3Object.setContentType(Mimetypes.MIMETYPE_BINARY_OCTET_STREAM); } else { s3Object.setContentType(Mimetypes.getInstance().getMimetype(dataFile)); File uploadFile = transformUploadFile(dataFile, s3Object, encryptionUtil, gzipFile, progressWatcher);
S3Object object = new S3Object(getPath()); object.setContentType(getContentType()); object.setContentType(value);
s3Object.setContentType(Mimetypes.MIMETYPE_BINARY_OCTET_STREAM); } else { s3Object.setContentType(Mimetypes.getInstance().getMimetype(dataFile)); File uploadFile = transformUploadFile(dataFile, s3Object, encryptionUtil, gzipFile, progressWatcher);
/** * Add default metadata. Do not add checksum as object metadata must remain constant for all chunks. */ protected S3Object getDetails(final Path file, final TransferStatus status) { final S3Object object = new S3Object(containerService.getKey(file)); final String mime = status.getMime(); if(StringUtils.isNotBlank(mime)) { object.setContentType(mime); } final Checksum checksum = status.getChecksum(); if(Checksum.NONE != checksum) { switch(checksum.algorithm) { case md5: // Set checksum on our own to avoid jets3t setting AWS metadata for MD5 as metadata must remain // constant for all chunks object.addMetadata("Content-MD5", ServiceUtils.toBase64(ServiceUtils.fromHex(checksum.hash))); break; } } return object; }
ByteArrayInputStream s3IS = new ByteArrayInputStream(chunk); s3Object.setDataInputStream(s3IS); s3Object.setContentType("binary/octet-stream"); s3Object.setContentLength(s3IS.available()); RestS3Service s3Service = null;
final String mime = status.getMime(); if(StringUtils.isNotBlank(mime)) { object.setContentType(mime);
private void put(String key, InputStream in, long length, boolean storeMetadata) throws IOException { try { S3Object object = new S3Object(key); object.setDataInputStream(in); object.setContentType("binary/octet-stream"); object.setContentLength(length); if (storeMetadata) { object.addAllMetadata(METADATA); } s3Service.putObject(bucket, object); } catch (S3ServiceException e) { if (e.getCause() instanceof IOException) { throw (IOException) e.getCause(); } throw new S3Exception(e); } }
private void put(String key, InputStream in, long length, boolean storeMetadata) throws IOException { try { S3Object object = new S3Object(key); object.setDataInputStream(in); object.setContentType("binary/octet-stream"); object.setContentLength(length); if (storeMetadata) { object.addAllMetadata(METADATA); } s3Service.putObject(bucket, object); } catch (S3ServiceException e) { if (e.getCause() instanceof IOException) { throw (IOException) e.getCause(); } throw new S3Exception(e); } }
private void put(String key, InputStream in, long length, boolean storeMetadata) throws IOException { try { S3Object object = new S3Object(key); object.setDataInputStream(in); object.setContentType("binary/octet-stream"); object.setContentLength(length); if (storeMetadata) { object.addAllMetadata(METADATA); } s3Service.putObject(bucket, object); } catch (S3ServiceException e) { if (e.getCause() instanceof IOException) { throw (IOException) e.getCause(); } throw new S3Exception(e); } }
summaryXmlObject.setContentType(Mimetypes.MIMETYPE_XML); summaryXmlObject.addMetadata(GatekeeperMessage.PROPERTY_TRANSACTION_ID, priorTransactionId); summaryXmlObject.addMetadata(GatekeeperMessage.SUMMARY_DOCUMENT_METADATA_FLAG, "true");