@Immutable @Loggable(value=1) public static final class Bucket.Prefixed extends Object implements Bucket
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"
Bucket.Prefixed
Constructor and Description |
---|
Bucket.Prefixed(Bucket bucket,
String pfx)
Public ctor.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(Bucket bucket) |
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.
|
public boolean exists() throws IOException
Bucket
exists
in interface Bucket
true
, otherwise false
IOException
- If any failure happenspublic void remove(String key) throws IOException
Bucket
remove
in interface Bucket
key
- Name of it in the bucketIOException
- If not found or any other failurepublic Iterable<String> list(String pfx) throws IOException
Bucket
list
in interface Bucket
pfx
- Prefix to useIOException
- If failspublic int compareTo(Bucket bucket)
compareTo
in interface Comparable<Bucket>
Copyright © 2012–2017 jcabi.com. All rights reserved.