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
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static final class 
    Creates bucket with specified origin bucket and prefix.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Checks if the bucket exists.
    list(String pfx)
    List object names with a given prefix.
    Get bucket name.
    Get object.
    Get region we're in.
    void
    Delete object from bucket.

    Methods inherited from interface java.lang.Comparable

    compareTo
  • Method Details

    • 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, otherwise false
      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