Class FkOcket

  • All Implemented Interfaces:
    Ocket, Comparable<Ocket>

    @Immutable
    @Loggable(1)
    public final class FkOcket
    extends Object
    implements Ocket
    Mock/fake ocket.
    Since:
    0.6
    Version:
    $Id: b8a0cff631ddcecca1d48f859c14bf5d22dbe2d8 $
    Author:
    Yegor Bugayenko ([email protected])
    • Constructor Detail

      • FkOcket

        public FkOcket​(Path file,
                       String bucket,
                       String key)
        Ctor.
        Parameters:
        file - Dir we're in
        bucket - Bucket
        key - Key
        Since:
        0.17
      • FkOcket

        public FkOcket​(File file,
                       String bucket,
                       String key)
        Ctor.
        Parameters:
        file - Dir we're in
        bucket - Bucket
        key - Key
      • FkOcket

        public FkOcket​(String file,
                       String bucket,
                       String key)
        Ctor.
        Parameters:
        file - Dir we're in
        bucket - Bucket
        key - Key
        Since:
        0.17
    • Method Detail

      • bucket

        public Bucket bucket()
        Description copied from interface: Ocket
        Get bucket we're in.
        Specified by:
        bucket in interface Ocket
        Returns:
        Bucket
      • key

        public String key()
        Description copied from interface: Ocket
        Get object key.
        Specified by:
        key in interface Ocket
        Returns:
        Key
      • meta

        public com.amazonaws.services.s3.model.ObjectMetadata meta()
        Description copied from interface: Ocket
        Object metadata.

        Throws OcketNotFoundException if this object doesn't exist in S3 bucket.

        Specified by:
        meta in interface Ocket
        Returns:
        Metadata
      • exists

        public boolean exists()
        Description copied from interface: Ocket
        Check whether this S3 object exists.
        Specified by:
        exists in interface Ocket
        Returns:
        TRUE if it exists in S3, FALSE otherwise
      • write

        public void write​(InputStream input,
                          com.amazonaws.services.s3.model.ObjectMetadata meta)
                   throws IOException
        Description copied from interface: Ocket
        Write new content to the object.
        Specified by:
        write in interface Ocket
        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
      • file

        public File file()
        Get my file.
        Returns:
        File