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 (yegor256@gmail.com)
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classBucket.PrefixedCreates bucket with specified origin bucket and prefix.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleanexists()Checks if the bucket exists.Iterable<String>list(String pfx)List object names with a given prefix.Stringname()Get bucket name.Ocketocket(String key)Get object.Regionregion()Get region we're in.voidremove(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 IOExceptionChecks 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
-
-