com.imos.sample.SampleS3.java Source code

Java tutorial

Introduction

Here is the source code for com.imos.sample.SampleS3.java

Source

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.imos.sample;

import com.amazonaws.auth.profile.ProfileCredentialsProvider;
import com.amazonaws.services.s3.AmazonS3;
import com.amazonaws.services.s3.AmazonS3Client;
import com.amazonaws.services.s3.model.GetObjectRequest;
import com.amazonaws.services.s3.model.S3Object;
import java.io.IOException;
import java.io.InputStream;

/**
 *
 * @author alok
 */
public class SampleS3 {

    public static void main(String[] args) throws IOException {
        AmazonS3 s3Client = new AmazonS3Client(new ProfileCredentialsProvider());
        S3Object object = s3Client.getObject(new GetObjectRequest("inv.adminconsole.test", ""));
        InputStream objectData = object.getObjectContent();
        // Process the objectData stream.
        objectData.close();
    }
}