Package com.jcabi.s3.fake
Class FkOcket
- java.lang.Object
-
- com.jcabi.s3.fake.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])
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.jcabi.s3.Ocket
Ocket.Empty, Ocket.Text
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Bucket
bucket()
Get bucket we're in.int
compareTo(Ocket ocket)
boolean
exists()
Check whether this S3 object exists.File
file()
Get my file.String
key()
Get object key.com.amazonaws.services.s3.model.ObjectMetadata
meta()
Object metadata.void
read(OutputStream output)
Read content.String
toString()
void
write(InputStream input, com.amazonaws.services.s3.model.ObjectMetadata meta)
Write new content to the object.
-
-
-
Constructor Detail
-
FkOcket
public FkOcket() throws IOException
Ctor.- Throws:
IOException
- If fails- Since:
- 0.17
-
FkOcket
public FkOcket(String bucket, String key) throws IOException
Ctor.- Parameters:
bucket
- Bucketkey
- Key- Throws:
IOException
- If fails- Since:
- 0.17
-
FkOcket
public FkOcket(Path file, String bucket, String key)
Ctor.- Parameters:
file
- Dir we're inbucket
- Bucketkey
- Key- Since:
- 0.17
-
FkOcket
public FkOcket(File file, String bucket, String key)
Ctor.- Parameters:
file
- Dir we're inbucket
- Bucketkey
- Key
-
-
Method Detail
-
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.
-
exists
public boolean exists()
Description copied from interface:Ocket
Check whether this S3 object exists.
-
read
public void read(OutputStream output) throws IOException
Description copied from interface:Ocket
Read content.Throws
OcketNotFoundException
if this object doesn't exist in S3 bucket.- Specified by:
read
in interfaceOcket
- Parameters:
output
- Where to write- Throws:
IOException
- If fails
-
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 interfaceOcket
- Parameters:
input
- Where to get contentmeta
- Metadata to save. Should contains input length for large object, otherwise multi-part uploads won't be possible.- Throws:
IOException
- If fails
-
compareTo
public int compareTo(Ocket ocket)
- Specified by:
compareTo
in interfaceComparable<Ocket>
-
file
public File file()
Get my file.- Returns:
- File
-
-