当前位置: 首页>>代码示例>>C#>>正文


C# AmazonS3.GetObject方法代码示例

本文整理汇总了C#中AmazonS3.GetObject方法的典型用法代码示例。如果您正苦于以下问题:C# AmazonS3.GetObject方法的具体用法?C# AmazonS3.GetObject怎么用?C# AmazonS3.GetObject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AmazonS3的用法示例。


在下文中一共展示了AmazonS3.GetObject方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ResizeImageAndUpload

 public static void ResizeImageAndUpload(AmazonS3 anAmazonS3Client, string aBucketName, string aCurrentPhotoName, string aNewImageName, int aSize)
 {
     GetObjectRequest myGetRequest = new GetObjectRequest().WithBucketName(aBucketName).WithKey(aCurrentPhotoName);
     GetObjectResponse myResponse = anAmazonS3Client.GetObject(myGetRequest);
     Stream myStream = myResponse.ResponseStream;
     ResizeAndUpload(myStream, anAmazonS3Client, aBucketName, aNewImageName, aSize);
 }
开发者ID:henryksarat,项目名称:Have-A-Voice,代码行数:7,代码来源:AWSPhotoHelper.cs

示例2: GetObject

 private static void GetObject(AmazonS3 s3Client, string bucket, string key)
 {
     var getObjectRequest = new GetObjectRequest().WithBucketName(bucket).WithKey(key);
       using (var getObjectResponse = s3Client.GetObject(getObjectRequest))
       {
     var memoryStream = new MemoryStream();
     getObjectResponse.ResponseStream.CopyTo(memoryStream);
     var content = Encoding.Default.GetString(memoryStream.ToArray());
     Console.WriteLine(content);
       }
 }
开发者ID:nrazon,项目名称:S3Emulator,代码行数:11,代码来源:Program.cs

示例3: RestoreFromAmazon

        private void RestoreFromAmazon(AmazonS3 client)
        {
            try
            {
                GetObjectRequest request = new GetObjectRequest()
                    .WithBucketName(this.BucketName)
                    .WithKey(FileLocations.CONFIG_FILENAME);

                using (GetObjectResponse response = client.GetObject(request))
                {
                    response.WriteResponseStreamToFile(settings.FileLocations.Configuration);
                    settings.ForceReload();
                }

                this.ErrorLabel.ForeColor = Color.Black;
                this.ErrorLabel.Text = "The restore was a success!";
            }
            catch (Exception exc)
            {
                this.ErrorLabel.ForeColor = Color.Red;
                this.ErrorLabel.Text = exc.Message;
            }
        }
开发者ID:oo00spy00oo,项目名称:SharedTerminals,代码行数:23,代码来源:AmazonOptionPanel.cs

示例4: GetFile

 public static System.IO.MemoryStream GetFile(AmazonS3 s3Client, string filekey)
 {
     using (s3Client)
     {
         S3_KEY = filekey;
         System.IO.MemoryStream file = new System.IO.MemoryStream();
         try
         {
             GetObjectResponse r = s3Client.GetObject(new GetObjectRequest()
             {
                 BucketName = BUCKET_NAME,
                 Key = S3_KEY
             });
             try
             {
                 long transferred = 0L;
                 System.IO.BufferedStream stream2 = new System.IO.BufferedStream(r.ResponseStream);
                 byte[] buffer = new byte[0x2000];
                 int count = 0;
                 while ((count = stream2.Read(buffer, 0, buffer.Length)) > 0)
                 {
                     file.Write(buffer, 0, count);
                 }
             }
             finally
             {
             }
             return file;
         }
         catch (AmazonS3Exception)
         {
             //Show exception
         }
     }
     return null;
 }
开发者ID:xescrp,项目名称:breinstormin,代码行数:36,代码来源:S3Engine.cs

示例5: getLastSession

        private void getLastSession()
        {
            string cookieName;
            string cookieValue;

            using (client = Amazon.AWSClientFactory.CreateAmazonS3Client("AKIAJ47VSG7WMA62WLCA", "3tqlHujlftpk6j/z5OtDw2eg9N2FJtz1RwL8bEa3"))
            {
                GetObjectRequest txtRequest = new GetObjectRequest();

                txtRequest.WithBucketName("intelrecruiter")
                            .WithKey(nsbeCookieValueKey);

                var response = client.GetObject(txtRequest);
                StreamReader reader = new StreamReader(response.ResponseStream);
                cookieValue = reader.ReadToEnd();
                response.Dispose();

                txtRequest = new GetObjectRequest();

                txtRequest.WithBucketName("intelrecruiter")
                            .WithKey(nsbeCookieNameKey);

                response = client.GetObject(txtRequest);
                reader = new StreamReader(response.ResponseStream);
                cookieName = reader.ReadToEnd();
                response.Dispose();

            }

            nsbeCookie = new Cookie(cookieName, cookieValue, "/");
        }
开发者ID:nnennaude,项目名称:recruiter-web,代码行数:31,代码来源:NSBESearch.cs


注:本文中的AmazonS3.GetObject方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。