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])
    • 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, 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