Package com.jcabi.s3
Interface Ocket
- All Superinterfaces:
Comparable<Ocket>
- All Known Implementing Classes:
CdOcket,FkOcket,Ocket.Empty,Ocket.Text,ReOcket
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
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final classOcket with no content at all.static final classUnicode text S3 object with supplementary functions. -
Method Summary
Modifier and TypeMethodDescriptionbucket()Get bucket we're in.booleanexists()Check whether this S3 object exists.key()Get object key.software.amazon.awssdk.services.s3.model.HeadObjectResponsemeta()Object metadata.voidread(OutputStream output) Read content.voidwrite(InputStream input, software.amazon.awssdk.services.s3.model.HeadObjectResponse meta) Write new content to the object.Methods inherited from interface java.lang.Comparable
compareTo
-
Method Details
-
bucket
Bucket bucket()Get bucket we're in.- Returns:
- Bucket
-
key
String key()Get object key.- Returns:
- Key
-
meta
Object metadata.Throws
OcketNotFoundExceptionif this object doesn't exist in S3 bucket.- Returns:
- Metadata
- Throws:
IOException- If fails
-
exists
Check whether this S3 object exists.- Returns:
- TRUE if it exists in S3, FALSE otherwise
- Throws:
IOException- If fails- Since:
- 0.4
-
read
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, software.amazon.awssdk.services.s3.model.HeadObjectResponse meta) throws IOException Write new content to the object.- Parameters:
input- Where to get contentmeta- Metadata to save- Throws:
IOException- If fails
-