Skip to content

Ocket.exists()

Compare
Choose a tag to compare
@yegor256 yegor256 released this 15 Dec 17:20
· 611 commits to master since this release

This version adds method exists() into Ocket interface. The method checks S3 object existence. It is recommended to use it before calling any other methods, in order to avoid IOException. For example:

Region region = new Region.Simple(key, secret);
Bucket bucket = region.bucket("example.com");
Ocket ocket = bucket.ocket("foo/README.txt");
String text;
if (ocket.exists()) {
  text = new Ocket.Text(ocket).read();
} else {
  text = "";
}

Besides that, this version makes Ocket and Bucket extend Comparable.