Package com.jcabi.s3
Class Bucket.Prefixed
java.lang.Object
com.jcabi.s3.Bucket.Prefixed
- All Implemented Interfaces:
Bucket,Comparable<Bucket>
- Enclosing interface:
- Bucket
Creates bucket with specified origin bucket and prefix.
Basically this class is used to cut off ocket keys of underlying bucket by some string known as prefix. If key is not started with prefix, it will be omitted
Example of usage:
final Region region = new MkRegion(
new TemporaryFolder().newFolder()
);
final Bucket bucket = region.bucket("test");
new Ocket.Text(bucket.ocket("a/first.txt")).write("");
new Ocket.Text(bucket.ocket("a/b/hello.txt")).write("");
new Ocket.Text(bucket.ocket("a/b/f/2.txt")).write("");
Bucket.Prefixed prefixed = new Bucket.Prefixed(
bucket, "a/b/"
);
Iterable<String> list = prefixed.list(
""
); // contains "hello.txt" and "f/2.txt"
- Since:
- 0.1
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.jcabi.s3.Bucket
Bucket.Prefixed -
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
Prefixed
Public ctor.- Parameters:
bucket- Original bucketpfx- Prefix
-
-
Method Details
-
region
Description copied from interface:BucketGet region we're in. -
name
Description copied from interface:BucketGet bucket name. -
ocket
Description copied from interface:BucketGet object. -
exists
Description copied from interface:BucketChecks if the bucket exists.- Specified by:
existsin interfaceBucket- Returns:
- If the bucket exists
true, otherwisefalse - Throws:
IOException- If any failure happens
-
remove
Description copied from interface:BucketDelete object from bucket.- Specified by:
removein interfaceBucket- Parameters:
key- Name of it in the bucket- Throws:
IOException- If not found or any other failure
-
list
Description copied from interface:BucketList object names with a given prefix.- Specified by:
listin interfaceBucket- Parameters:
pfx- Prefix to use- Returns:
- Iterable of names
- Throws:
IOException- If fails
-
compareTo
- Specified by:
compareToin interfaceComparable<Bucket>
-