public class ServiceUtils
extends java.lang.Object
| 修飾子とタイプ | クラスと説明 |
|---|---|
static interface |
ServiceUtils.RetryableS3DownloadTask
Interface for the task of downloading object from S3 to a specific file,
enabling one-time retry mechanism after integrity check failure
on the downloaded file.
|
| コンストラクタと説明 |
|---|
ServiceUtils() |
| 修飾子とタイプ | メソッドと説明 |
|---|---|
static java.net.URL |
convertRequestToUrl(Request<?> request)
Converts the specified request object into a URL, containing all the
specified parameters, the specified request endpoint, etc.
|
static void |
downloadObjectToFile(S3Object s3Object,
java.io.File destinationFile,
boolean performIntegrityCheck)
Downloads an S3Object, as returned from
AmazonS3Client.getObject(com.amazonaws.services.s3.model.GetObjectRequest),
to the specified file. |
static java.lang.String |
formatIso8601Date(java.util.Date date) |
static java.lang.String |
formatRfc822Date(java.util.Date date) |
static boolean |
isMultipartUploadETag(java.lang.String eTag)
Returns true if the specified ETag was from a multipart upload.
|
static java.lang.String |
join(java.util.List<java.lang.String> strings)
Returns a new string created by joining each of the strings in the
specified list together, with a comma between them.
|
static java.util.Date |
parseIso8601Date(java.lang.String dateString) |
static java.util.Date |
parseRfc822Date(java.lang.String dateString) |
static java.lang.String |
removeQuotes(java.lang.String s)
Removes any surrounding quotes from the specified string and returns a
new string.
|
static S3Object |
retryableDownloadS3ObjectToFile(java.io.File file,
ServiceUtils.RetryableS3DownloadTask retryableS3DownloadTask)
Gets an object stored in S3 and downloads it into the specified file.
|
static byte[] |
toByteArray(java.lang.String s)
Safely converts a string to a byte array, first attempting to explicitly
use our preferred encoding (UTF-8), and then falling back to the
platform's default encoding if for some reason our preferred encoding
isn't supported.
|
protected static final DateUtils dateUtils
public static java.util.Date parseIso8601Date(java.lang.String dateString)
throws java.text.ParseException
java.text.ParseExceptionpublic static java.lang.String formatIso8601Date(java.util.Date date)
public static java.util.Date parseRfc822Date(java.lang.String dateString)
throws java.text.ParseException
java.text.ParseExceptionpublic static java.lang.String formatRfc822Date(java.util.Date date)
public static boolean isMultipartUploadETag(java.lang.String eTag)
eTag - The ETag to test.public static byte[] toByteArray(java.lang.String s)
s - The string to convert to a byte array.public static java.lang.String removeQuotes(java.lang.String s)
s - The string to check for surrounding quotes.public static java.net.URL convertRequestToUrl(Request<?> request)
request - The request to convert into a URL.AmazonClientException - If the request cannot be converted to a well formed URL.public static java.lang.String join(java.util.List<java.lang.String> strings)
strings - The list of strings to join into a single, comma delimited
string list.public static void downloadObjectToFile(S3Object s3Object, java.io.File destinationFile, boolean performIntegrityCheck)
AmazonS3Client.getObject(com.amazonaws.services.s3.model.GetObjectRequest),
to the specified file.s3Object - The S3Object containing a reference to an InputStream
containing the object's data.destinationFile - The file to store the object's data in.performIntegrityCheck - Boolean valuable to indicate whether do the integrity check or notpublic static S3Object retryableDownloadS3ObjectToFile(java.io.File file, ServiceUtils.RetryableS3DownloadTask retryableS3DownloadTask)
file - The file to store the object's data in.safeS3DownloadTask - The implementation of SafeS3DownloadTask interface which allows user to
get access to all the visible variables at the calling site of this method.