@IdiotProofImmutable public final class DefaultS3Service extends Object implements S3Service
Modifier and Type | Class and Description |
---|---|
static class |
DefaultS3Service.Builder |
Modifier and Type | Method and Description |
---|---|
static DefaultS3Service |
build(com.amazonaws.auth.AWSCredentials credentials) |
static DefaultS3Service.Builder |
builder(com.amazonaws.auth.AWSCredentials credentials) |
CopyObjectResult |
copyObject(String bucket,
String srcKey,
String dstKey)
Copy an object in a bucket to another name.
|
File |
copyObjectToFile(String bucket,
String key,
File file) |
void |
copyObjectToStream(String bucket,
String key,
OutputStream out) |
Bucket |
createBucket(String bucket)
Create a new bucket
|
boolean |
exists(String bucket,
String key)
Return true if this key exists in this bucket.
|
List<ObjectSummary> |
getCompleteList(String bucket,
String prefix) |
com.amazonaws.auth.AWSCredentials |
getCredentials() |
com.amazonaws.services.s3.model.CannedAccessControlList |
getDefaultPermissions() |
String |
getDirectoryContentType() |
ObjectMetadata |
getMetadata(String bucket,
String key)
Return metadata about the object stored in the bucket under the specified key
|
ObjectListing |
getObjectListing(ListObjectsRequest request) |
com.google.common.base.Optional<ObjectMetadata> |
getOptionalMetadata(String bucket,
String key)
Return metadata for the object stored in the indicated bucket and key.
|
Bucket |
getOrCreateBucketOwnedByMe(String bucket)
Return the bucket if it exists, otherwise create and return a new bucket
|
String |
getRegion()
Return the region we are operating on
|
ObjectSummary |
getSummary(String bucket,
String key) |
PutObjectResult |
putDirectory(PutDirRequest request)
Create a "directory" on S3.
|
PutObjectResult |
putDirectory(String bucket,
String key)
Create a "directory" on S3.
|
PutObjectResult |
putFile(PutFileRequest request)
Create a file on S3 from a regular file on the local file system
|
PutObjectResult |
putFile(String bucket,
String key,
File file)
Copy a file from the local file system to a bucket using UTF8
|
PutObjectResult |
putFile(String bucket,
String key,
File file,
String encoding)
Copy a file from the local file system to a bucket using the indicated encoding
|
String |
readObjectToString(String bucket,
String key)
Read the contents of an object into a string using UTF8
|
PutObjectResult |
writeStringToObject(String bucket,
String key,
String data)
Write a string to a bucket using UTF8
|
public PutObjectResult putDirectory(String bucket, String key)
S3Service
putDirectory
in interface S3Service
public PutObjectResult putDirectory(PutDirRequest request)
S3Service
putDirectory
in interface S3Service
public ObjectSummary getSummary(String bucket, String key)
getSummary
in interface S3Service
public List<ObjectSummary> getCompleteList(String bucket, String prefix)
getCompleteList
in interface S3Service
public ObjectListing getObjectListing(ListObjectsRequest request)
getObjectListing
in interface S3Service
public Bucket getOrCreateBucketOwnedByMe(String bucket)
S3Service
getOrCreateBucketOwnedByMe
in interface S3Service
public Bucket createBucket(String bucket)
S3Service
createBucket
in interface S3Service
public ObjectMetadata getMetadata(String bucket, String key)
getMetadata
in interface S3Service
IllegalArgumentException
- If bucket or key are blank, the bucket does not exist, or this key does not exist in this bucketcom.amazonaws.services.s3.model.AmazonS3Exception
- If the bucket exists but permissions deny read access to the bucket or objectpublic com.google.common.base.Optional<ObjectMetadata> getOptionalMetadata(String bucket, String key)
S3Service
getOptionalMetadata
in interface S3Service
public boolean exists(String bucket, String key)
S3Service
public PutObjectResult putFile(String bucket, String key, File file)
S3Service
public PutObjectResult putFile(String bucket, String key, File file, String encoding)
S3Service
public PutObjectResult putFile(PutFileRequest request)
public PutObjectResult writeStringToObject(String bucket, String key, String data)
S3Service
writeStringToObject
in interface S3Service
public String readObjectToString(String bucket, String key)
S3Service
readObjectToString
in interface S3Service
public void copyObjectToStream(String bucket, String key, OutputStream out)
copyObjectToStream
in interface S3Service
public File copyObjectToFile(String bucket, String key, File file)
copyObjectToFile
in interface S3Service
public CopyObjectResult copyObject(String bucket, String srcKey, String dstKey)
copyObject
in interface S3Service
public static DefaultS3Service build(com.amazonaws.auth.AWSCredentials credentials)
public static DefaultS3Service.Builder builder(com.amazonaws.auth.AWSCredentials credentials)
public com.amazonaws.auth.AWSCredentials getCredentials()
public String getRegion()
S3Service
public com.amazonaws.services.s3.model.CannedAccessControlList getDefaultPermissions()
public String getDirectoryContentType()
Copyright © 2004–2014 The Kuali Foundation. All rights reserved.