Java
Chilkat2 Java
Wasabi Download File
See more Wasabi Examples
Demonstrates how to download a file from a Wasabi bucket.Chilkat Java Downloads
import com.chilkatsoft.chilkat2.ChilkatException;
import com.chilkatsoft.chilkat2.Http;
public class ChilkatExample {
public static void main(String[] args) {
// This requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
Http http = new Http();
// Insert your access key here:
http.setAwsAccessKey("access-key");
// Insert your secret key here:
http.setAwsSecretKey("secret-key");
// Use the endpoint matching the bucket's region.
http.setAwsEndpoint("s3.us-west-1.wasabisys.com");
String bucketName = "chilkat-west";
String objectName = "seahorse.jpg";
String localFilePath = "c:/temp/qa_output/seahorse.jpg";
try {
http.s3DownloadFile(bucketName, objectName, localFilePath);
System.out.println("File downloaded.");
} catch (ChilkatException e) {
System.out.println(e.getLastErrorText());
}
}
}