Java Code Examples for com.amazonaws.services.s3.AmazonS3.setRegion()
The following are Jave code examples for showing how to use
setRegion() of the
com.amazonaws.services.s3.AmazonS3
class.
You can vote up the examples you like. Your votes will be used in our system to get
more good examples.
+ Save this method
Example 1
Project: full-javaee-app File: S3Object.java View Source Code | 6 votes |
public static String webHookDump(InputStream stream, String school, String extension) { if (stream != null) { extension = extension == null || extension.isEmpty() ? ".xml" : extension.contains(".") ? extension : "." + extension; String fileName = "webhooks/" + school + "/" + school + "_" + Clock.getCurrentDateDashes() + "_" + Clock.getCurrentTime() + extension; AmazonS3 s3 = new AmazonS3Client(); Region region = Region.getRegion(Regions.US_WEST_2); s3.setRegion(region); try { File file = CustomUtilities.inputStreamToFile(stream); s3.putObject(new PutObjectRequest(name, fileName, file)); return CustomUtilities.fileToString(file); } catch (Exception e) { e.printStackTrace(); } } return ""; }