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.Textdecorator: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 classOcket.EmptyOcket with no content at all.static classOcket.TextUnicode text S3 object with supplementary functions.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Bucketbucket()Get bucket we're in.booleanexists()Check whether this S3 object exists.Stringkey()Get object key.com.amazonaws.services.s3.model.ObjectMetadatameta()Object metadata.voidread(OutputStream output)Read content.voidwrite(InputStream input, com.amazonaws.services.s3.model.ObjectMetadata meta)Write new content to the object.-
Methods inherited from interface java.lang.Comparable
compareTo
-
-
-
-
Method Detail
-
bucket
Bucket bucket()
Get bucket we're in.- Returns:
- Bucket
-
key
String key()
Get object key.- Returns:
- Key
-
meta
com.amazonaws.services.s3.model.ObjectMetadata meta() throws IOExceptionObject metadata.Throws
OcketNotFoundExceptionif this object doesn't exist in S3 bucket.- Returns:
- Metadata
- Throws:
IOException- If fails
-
exists
boolean exists() throws IOExceptionCheck whether this S3 object exists.- Returns:
- TRUE if it exists in S3, FALSE otherwise
- Throws:
IOException- If fails- Since:
- 0.4
-
read
void read(OutputStream output) throws IOException
Read content.Throws
OcketNotFoundExceptionif this object doesn't exist in S3 bucket.- Parameters:
output- Where to write- Throws:
IOException- If fails
-
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 contentmeta- Metadata to save. Should contains input length for large object, otherwise multi-part uploads won't be possible.- Throws:
IOException- If fails
-
-