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


C# TransferUtilityUploadRequest.IsSetInputStream方法代码示例

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


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

示例1: validate

        void validate(TransferUtilityUploadRequest request)
        {
            if (request == null)
            {
                throw new ArgumentNullException("request");
            }

            if (!request.IsSetBucketName())
            {
                throw new ArgumentNullException("bucketName");
            }

            if (!request.IsSetFilePath() &&
                !request.IsSetInputStream())
            {
                throw new ArgumentException(
                    "Please specify either a Filename or provide a Stream to PUT an object into S3.");
            }
            if (!request.IsSetKey())
            {
                if (request.IsSetFilePath())
                {
                    request.Key = new FileInfo(request.FilePath).Name;
                }
                else
                {
                    throw new ArgumentException(
                        "The Key property must be specified when using a Stream to upload into S3.");
                }
            }

            if (request.IsSetFilePath() && !File.Exists(request.FilePath))
                throw new ArgumentException("The file indicated by the FilePath property does not exist!");
        }
开发者ID:buddydvd,项目名称:aws-sdk-for-net,代码行数:34,代码来源:TransferUtility.cs

示例2: Upload

        /// <summary>
        /// 	Uploads the file or stream specified by the request.  
        /// 	To track the progress of the upload,
        /// 	add an event listener to the request's <c>UploadProgressEvent</c>.
        /// 	For large uploads, the file will be divided and uploaded in parts using 
        /// 	Amazon S3's multipart API.  The parts will be reassembled as one object in
        /// 	Amazon S3.
        /// </summary>
        /// <param name="request">
        /// 	Contains all the parameters used for uploading to Amazon S3.
        /// </param>
        public void Upload(TransferUtilityUploadRequest request)
        {
            if (request == null)
            {
                throw new ArgumentNullException("request");
            }

            if (!request.IsSetBucketName())
            {
                throw new ArgumentNullException("bucketName");
            }

            if (!request.IsSetFilePath() &&
                !request.IsSetInputStream())
            {
                throw new ArgumentException(
                    "Please specify either a Filename or provide a Stream to PUT an object into S3.");
            }
            if (!request.IsSetKey())
            {
                if (request.IsSetFilePath())
                {
                    request.Key = new FileInfo(request.FilePath).Name;
                }
                else
                {
                    throw new ArgumentException(
                        "The Key property must be specified when using a Stream to upload into S3.");
                }
            }

            if (request.IsSetFilePath() && !File.Exists(request.FilePath))
                throw new ArgumentException("The file indicated by the FilePath property does not exist!");

            if (request.ContentLength < this._config.MinSizeBeforePartUpload)
            {
                SimpleUploadCommand uploader = new SimpleUploadCommand(this._s3Client, this._config, request);
                uploader.Execute();
            }
            else
            {
                MultipartUploadCommand uploader = new MultipartUploadCommand(this._s3Client, this._config, request);
                uploader.Execute();
            }
        }
开发者ID:puffpio,项目名称:awssdk-async,代码行数:56,代码来源:TransferUtility.cs


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