@Immutable public interface Ocket extends Comparable<Ocket>
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");
Modifier and Type | Interface and Description |
---|---|
static class |
Ocket.Empty
Ocket with no content at all.
|
static class |
Ocket.Text
Unicode text S3 object with supplementary functions.
|
Modifier and Type | Method and Description |
---|---|
Bucket |
bucket()
Get bucket we're in.
|
boolean |
exists()
Check whether this S3 object exists.
|
String |
key()
Get object key.
|
com.amazonaws.services.s3.model.ObjectMetadata |
meta()
Object metadata.
|
void |
read(OutputStream output)
Read content.
|
void |
write(InputStream input,
com.amazonaws.services.s3.model.ObjectMetadata meta)
Write new content to the object.
|
compareTo
Bucket bucket()
String key()
com.amazonaws.services.s3.model.ObjectMetadata meta() throws IOException
Throws OcketNotFoundException
if this object
doesn't exist in S3 bucket.
IOException
- If failsboolean exists() throws IOException
IOException
- If failsvoid read(OutputStream output) throws IOException
Throws OcketNotFoundException
if this object
doesn't exist in S3 bucket.
output
- Where to writeIOException
- If failsvoid write(InputStream input, com.amazonaws.services.s3.model.ObjectMetadata meta) throws IOException
input
- Where to get contentmeta
- Metadata to save. Should contains input length for large
object, otherwise multi-part uploads won't be possible.IOException
- If failsCopyright © 2012–2017 jcabi.com. All rights reserved.