/** * Create an object representing text data. The object is initialized with the given * key, the given string as its data content (encoded as UTF-8), a content type of * <code>text/plain; charset=utf-8</code>, and a content length matching the * string's length. * The given string's MD5 hash value is also calculated and provided to the target * service, so the service can verify that no data are corrupted in transit. * <p> * <b>NOTE:</b> The automatic calculation of the MD5 hash digest as performed by * this constructor could take some time for large strings, or for many small ones. * * @param key * the key name for the object. * @param dataString * the text data the object will contain. Text data will be encoded as UTF-8. * This string cannot be null. * * @throws IOException * @throws NoSuchAlgorithmException when this JRE doesn't support the MD5 hash algorithm */ public StorageObject(String key, String dataString) throws NoSuchAlgorithmException, IOException { this(key); ByteArrayInputStream bais = new ByteArrayInputStream( dataString.getBytes(Constants.DEFAULT_ENCODING)); setDataInputStream(bais); setContentLength(bais.available()); setContentType("text/plain; charset=utf-8"); setMd5Hash(ServiceUtils.computeMD5Hash(dataString.getBytes(Constants.DEFAULT_ENCODING))); }
/** * Create an object representing text data. The object is initialized with the given * key, the given string as its data content (encoded as UTF-8), a content type of * <code>text/plain; charset=utf-8</code>, and a content length matching the * string's length. * The given string's MD5 hash value is also calculated and provided to the target * service, so the service can verify that no data are corrupted in transit. * <p> * <b>NOTE:</b> The automatic calculation of the MD5 hash digest as performed by * this constructor could take some time for large strings, or for many small ones. * * @param key * the key name for the object. * @param dataString * the text data the object will contain. Text data will be encoded as UTF-8. * This string cannot be null. * * @throws IOException * @throws NoSuchAlgorithmException when this JRE doesn't support the MD5 hash algorithm */ public StorageObject(String key, String dataString) throws NoSuchAlgorithmException, IOException { this(key); ByteArrayInputStream bais = new ByteArrayInputStream( dataString.getBytes(Constants.DEFAULT_ENCODING)); setDataInputStream(bais); setContentLength(bais.available()); setContentType("text/plain; charset=utf-8"); setMd5Hash(ServiceUtils.computeMD5Hash(dataString.getBytes(Constants.DEFAULT_ENCODING))); }
/** * Create an object representing binary data. The object is initialized with the given * key, the bytes as its data content, a content type of * <code>application/octet-stream</code>, and a content length matching the * byte array's length. * The MD5 hash value of the byte data is also calculated and provided to the target * service, so the service can verify that no data are corrupted in transit. * * @param key * the key name for the object. * @param data * the byte data the object will contain, cannot be null. * * @throws IOException * @throws NoSuchAlgorithmException when this JRE doesn't support the MD5 hash algorithm */ public StorageObject(String key, byte[] data) throws NoSuchAlgorithmException, IOException { this(key); ByteArrayInputStream bais = new ByteArrayInputStream(data); setDataInputStream(bais); setContentLength(bais.available()); setContentType(Mimetypes.MIMETYPE_OCTET_STREAM); setMd5Hash(ServiceUtils.computeMD5Hash(data)); }
/** * Create an object representing binary data. The object is initialized with the given * key, the bytes as its data content, a content type of * <code>application/octet-stream</code>, and a content length matching the * byte array's length. * The MD5 hash value of the byte data is also calculated and provided to the target * service, so the service can verify that no data are corrupted in transit. * * @param key * the key name for the object. * @param data * the byte data the object will contain, cannot be null. * * @throws IOException * @throws NoSuchAlgorithmException when this JRE doesn't support the MD5 hash algorithm */ public StorageObject(String key, byte[] data) throws NoSuchAlgorithmException, IOException { this(key); ByteArrayInputStream bais = new ByteArrayInputStream(data); setDataInputStream(bais); setContentLength(bais.available()); setContentType(Mimetypes.MIMETYPE_OCTET_STREAM); setMd5Hash(ServiceUtils.computeMD5Hash(data)); }
StorageObject encryptedCredentialsObject = new StorageObject(credentialObjectKey[0]); encryptedCredentialsObject.setDataInputStream(bais[0]); encryptedCredentialsObject.setAcl(AccessControlList.REST_CANNED_PUBLIC_READ);
StorageObject encryptedCredentialsObject = new StorageObject(credentialObjectKey[0]); encryptedCredentialsObject.setDataInputStream(bais[0]); encryptedCredentialsObject.setAcl(AccessControlList.REST_CANNED_PUBLIC_READ);
if(!headOnly) { HttpMethodReleaseInputStream releaseIS = new HttpMethodReleaseInputStream(httpResponse); responseObject.setDataInputStream(releaseIS);
if(!headOnly) { HttpMethodReleaseInputStream releaseIS = new HttpMethodReleaseInputStream(httpResponse); responseObject.setDataInputStream(releaseIS);
public void run() { try { File underlyingFile = object.getDataInputFile(); if (object.getDataInputStream() != null) { interruptableInputStream = new InterruptableInputStream(object.getDataInputStream()); ProgressMonitoredInputStream pmInputStream = new ProgressMonitoredInputStream( interruptableInputStream, progressMonitor); object.setDataInputStream(pmInputStream); } result = storageService.putObject(bucketName, object); if (underlyingFile instanceof TempFile) { underlyingFile.delete(); } } catch (ServiceException e) { result = e; } }
public void run() { try { File underlyingFile = object.getDataInputFile(); if (object.getDataInputStream() != null) { interruptableInputStream = new InterruptableInputStream(object.getDataInputStream()); ProgressMonitoredInputStream pmInputStream = new ProgressMonitoredInputStream( interruptableInputStream, progressMonitor); object.setDataInputStream(pmInputStream); } result = storageService.putObject(bucketName, object); if (underlyingFile instanceof TempFile) { underlyingFile.delete(); } } catch (ServiceException e) { result = e; } }
object.setDataInputStream(null); object.setDataInputFile(downloadPackage.getDataFile());
object.setDataInputStream(null); object.setDataInputFile(downloadPackage.getDataFile());