public class ObjectUtils
extends java.lang.Object
Constructor and Description |
---|
ObjectUtils() |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
convertDirPlaceholderKeyNameToDirName(java.lang.String objectKey) |
static S3Object |
createObjectForUpload(java.lang.String objectKey,
java.io.File dataFile,
byte[] md5HashOfDataFile,
EncryptionUtil encryptionUtil,
boolean gzipFile,
BytesProgressWatcher progressWatcher)
Prepares a file for upload to a named object in S3, potentially transforming it if
zipping or encryption is requested.
|
static S3Object |
createObjectForUpload(java.lang.String objectKey,
java.io.File dataFile,
EncryptionUtil encryptionUtil,
boolean gzipFile)
Prepares a file for upload to a named object in S3, potentially transforming it if
zipping or encryption is requested.
|
static S3Object |
createObjectForUpload(java.lang.String objectKey,
java.io.File dataFile,
EncryptionUtil encryptionUtil,
boolean gzipFile,
BytesProgressWatcher progressWatcher)
Prepares a file for upload to a named object in S3, potentially transforming it if
zipping or encryption is requested.
|
static DownloadPackage |
createPackageForDownload(S3Object object,
java.io.File fileTarget,
boolean automaticUnzip,
boolean automaticDecrypt,
java.lang.String encryptionPassword)
Deprecated.
0.8.0 use
createPackageForDownload(StorageObject, File, boolean, boolean, String) instead. |
static DownloadPackage |
createPackageForDownload(StorageObject object,
java.io.File fileTarget,
boolean automaticUnzip,
boolean automaticDecrypt,
java.lang.String encryptionPassword)
Creates a download package representing an S3Object that will be downloaded, and the
target file the downloaded data will be written to.
|
public static S3Object createObjectForUpload(java.lang.String objectKey, java.io.File dataFile, byte[] md5HashOfDataFile, EncryptionUtil encryptionUtil, boolean gzipFile, BytesProgressWatcher progressWatcher) throws java.lang.Exception
The file will have the following metadata items added:
Constants.METADATA_JETS3T_LOCAL_FILE_DATE
: The local file's last modified date
in ISO 8601 formatMimetypes.MIMETYPE_BINARY_OCTET_STREAM
if the file is a directoryStorageObject.METADATA_HEADER_ORIGINAL_HASH_MD5
: An MD5 hash of the
original file's data (added if gzipping or encryption is applied)objectKey
- the object key name to use in S3dataFile
- the file to prepare for upload.md5HashOfDataFile
- calculated MD5 hash value of the given dataFile; if null this value will be calculated
automatically.encryptionUtil
- if this variable is null no encryption will be applied, otherwise the provided
encryption utility object will be used to encrypt the file's data.gzipFile
- if true the file will be Gzipped.progressWatcher
- watcher to monitor progress of file transformation and hash generation.java.lang.Exception
- exceptions could include IO failures, gzipping and encryption failures.public static S3Object createObjectForUpload(java.lang.String objectKey, java.io.File dataFile, EncryptionUtil encryptionUtil, boolean gzipFile, BytesProgressWatcher progressWatcher) throws java.lang.Exception
The file will have the following metadata items added:
Constants.METADATA_JETS3T_LOCAL_FILE_DATE
: The local file's last modified date
in ISO 8601 formatMimetypes.MIMETYPE_BINARY_OCTET_STREAM
if the file is a directoryStorageObject.METADATA_HEADER_ORIGINAL_HASH_MD5
: An MD5 hash of the
original file's data (added if gzipping or encryption is applied)objectKey
- the object key name to use in S3dataFile
- the file to prepare for upload.encryptionUtil
- if this variable is null no encryption will be applied, otherwise the provided
encryption utility object will be used to encrypt the file's data.gzipFile
- if true the file will be Gzipped.progressWatcher
- watcher to monitor progress of file transformation and hash generation.java.lang.Exception
- exceptions could include IO failures, gzipping and encryption failures.public static S3Object createObjectForUpload(java.lang.String objectKey, java.io.File dataFile, EncryptionUtil encryptionUtil, boolean gzipFile) throws java.lang.Exception
The file will have the following metadata items added:
Constants.METADATA_JETS3T_LOCAL_FILE_DATE
: The local file's last modified date
in ISO 8601 formatMimetypes.MIMETYPE_BINARY_OCTET_STREAM
if the file is a directoryStorageObject.METADATA_HEADER_ORIGINAL_HASH_MD5
: An MD5 hash of the original file's
data (added if gzipping or encryption is applied)objectKey
- the object key name to use in S3dataFile
- the file to prepare for upload.encryptionUtil
- if this variable is null no encryption will be applied, otherwise the provided
encryption utility object will be used to encrypt the file's data.gzipFile
- if true the file will be Gzipped.java.lang.Exception
- exceptions could include IO failures, gzipping and encryption failures.public static DownloadPackage createPackageForDownload(StorageObject object, java.io.File fileTarget, boolean automaticUnzip, boolean automaticDecrypt, java.lang.String encryptionPassword) throws java.lang.Exception
Downloaded data may be transformed if the S3Object is encrypted or gzipped and the appropriate options are set.
object
- the objectfileTarget
- the file to which downloaded (and possibly transformed) data will be written.automaticUnzip
- if true, gzipped objects will be decrypted on-the-fly as they are downloaded.automaticDecrypt
- if true, encrypted files will be decrypted on-the-fly as they are downloaded (in which
case the encryptionPassword must be correct)encryptionPassword
- the password required to decrypt encrypted objects.java.lang.Exception
@Deprecated public static DownloadPackage createPackageForDownload(S3Object object, java.io.File fileTarget, boolean automaticUnzip, boolean automaticDecrypt, java.lang.String encryptionPassword) throws java.lang.Exception
createPackageForDownload(StorageObject, File, boolean, boolean, String)
instead.Downloaded data may be transformed if the S3Object is encrypted or gzipped and the appropriate options are set.
object
- the objectfileTarget
- the file to which downloaded (and possibly transformed) data will be written.automaticUnzip
- if true, gzipped objects will be decrypted on-the-fly as they are downloaded.automaticDecrypt
- if true, encrypted files will be decrypted on-the-fly as they are downloaded (in which
case the encryptionPassword must be correct)encryptionPassword
- the password required to decrypt encrypted objects.java.lang.Exception
public static java.lang.String convertDirPlaceholderKeyNameToDirName(java.lang.String objectKey)