Package com.jcabi.s3
Interface Bucket
-
- All Superinterfaces:
Comparable<Bucket>
- All Known Implementing Classes:
Bucket.Prefixed
,CdBucket
,FkBucket
,ReBucket
public interface Bucket extends Comparable<Bucket>
Amazon S3 bucket.You get an instance of this interface from
Region
, for example:Region region = new Region.Simple(key, secret); Bucket bucket = region.bucket("my.example.com"); for (String key : bucket.list("")) { System.out.println( "key: " + key + ", last modified: " + bucket.get(key).meta().getLastModified() ); }
- Since:
- 0.1
- Version:
- $Id: ee340d412e44a6ac4f7026d2251f774496ae6713 $
- Author:
- Yegor Bugayenko ([email protected])
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
Bucket.Prefixed
Creates bucket with specified origin bucket and prefix.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
exists()
Checks if the bucket exists.Iterable<String>
list(String pfx)
List object names with a given prefix.String
name()
Get bucket name.Ocket
ocket(String key)
Get object.Region
region()
Get region we're in.void
remove(String key)
Delete object from bucket.-
Methods inherited from interface java.lang.Comparable
compareTo
-
-
-
-
Method Detail
-
region
Region region()
Get region we're in.- Returns:
- Region
-
name
String name()
Get bucket name.- Returns:
- Bucket name
-
ocket
Ocket ocket(String key)
Get object.- Parameters:
key
- Name of it in the bucket- Returns:
- Ocket
-
exists
boolean exists() throws IOException
Checks if the bucket exists.- Returns:
- If the bucket exists
true
, otherwisefalse
- Throws:
IOException
- If any failure happens
-
remove
void remove(String key) throws IOException
Delete object from bucket.- Parameters:
key
- Name of it in the bucket- Throws:
IOException
- If not found or any other failure
-
list
Iterable<String> list(String pfx) throws IOException
List object names with a given prefix.- Parameters:
pfx
- Prefix to use- Returns:
- Iterable of names
- Throws:
IOException
- If fails- Since:
- 0.3
-
-