Package com.jcabi.s3

Interface Ocket

  • All Superinterfaces:
    Comparable<Ocket>
    All Known Implementing Classes:
    CdOcket, FkOcket, Ocket.Empty, Ocket.Text, ReOcket

    public interface Ocket
    extends Comparable<Ocket>
    Amazon S3 object abstraction.

    You get an instance of this interface from Bucket, for example:

     Region region = new Region.Simple(key, secret);
     Bucket bucket = region.bucket("my.example.com");
     Ocket ocket = bucket.ocket("src/main/README.txt");

    In order to read and write plain text content in Unicode we recommend to use Ocket.Text decorator:

     Ocket.Text ocket = new Ocket.Smart(
       bucket.ocket("src/main/README.txt")
     );
     ocket.write("hello, world!", "text/plain");
     
    Since:
    0.1
    Version:
    $Id: 936d91a237c682b5089f21d4f6989dc610bcaffc $
    Author:
    Yegor Bugayenko (yegor256@gmail.com)
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Interface Description
      static class  Ocket.Empty
      Ocket with no content at all.
      static class  Ocket.Text
      Unicode text S3 object with supplementary functions.
    • Method Detail

      • bucket

        Bucket bucket()
        Get bucket we're in.
        Returns:
        Bucket
      • key

        String key()
        Get object key.
        Returns:
        Key
      • exists

        boolean exists()
                throws IOException
        Check whether this S3 object exists.
        Returns:
        TRUE if it exists in S3, FALSE otherwise
        Throws:
        IOException - If fails
        Since:
        0.4
      • write

        void write​(InputStream input,
                   com.amazonaws.services.s3.model.ObjectMetadata meta)
            throws IOException
        Write new content to the object.
        Parameters:
        input - Where to get content
        meta - Metadata to save. Should contains input length for large object, otherwise multi-part uploads won't be possible.
        Throws:
        IOException - If fails