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


C# IDataStore.GetReadStream方法代码示例

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


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

示例1: CrossCopy

        ///<summary>
        /// Copy from one module to another. Can copy from s3 to disk and vice versa
        ///</summary>
        ///<param name="srcStore"></param>
        ///<param name="srcDomain"></param>
        ///<param name="srcFilename"></param>
        ///<param name="dstStore"></param>
        ///<param name="dstDomain"></param>
        ///<param name="dstFilename"></param>
        ///<returns></returns>
        ///<exception cref="ArgumentNullException"></exception>
        public static Uri CrossCopy(IDataStore srcStore, string srcDomain, string srcFilename, IDataStore dstStore,
                                    string dstDomain, string dstFilename)
        {
            if (srcStore == null) throw new ArgumentNullException("srcStore");
            if (srcDomain == null) throw new ArgumentNullException("srcDomain");
            if (srcFilename == null) throw new ArgumentNullException("srcFilename");
            if (dstStore == null) throw new ArgumentNullException("dstStore");
            if (dstDomain == null) throw new ArgumentNullException("dstDomain");
            if (dstFilename == null) throw new ArgumentNullException("dstFilename");
            //Read contents
            using (Stream srcStream = srcStore.GetReadStream(srcDomain, srcFilename))
            {
                using (var memoryStream = TempStream.Create())
                {
                    //Copy
                    var buffer = new byte[4096];
                    int readed;
                    while ((readed = srcStream.Read(buffer, 0, 4096)) != 0)
                    {
                        memoryStream.Write(buffer, 0, readed);
                    }

                    memoryStream.Position = 0;
                    return dstStore.Save(dstDomain, dstFilename, memoryStream);
                }
            }
        }
开发者ID:Inzaghi2012,项目名称:teamlab.v7.5,代码行数:38,代码来源:CrossModuleCopy.cs

示例2: LoadDataStoreItemData

 public static byte[] LoadDataStoreItemData(string domain, string fileLink, IDataStore storage)
 {
     using (var stream = storage.GetReadStream(domain, fileLink))
     {
         return stream.GetCorrectBuffer();
     }
 }
开发者ID:vipwan,项目名称:CommunityServer,代码行数:7,代码来源:StorageManager.cs

示例3: LoadAttachmentData

 private static void LoadAttachmentData(MailAttachment attach, string domain, string file_link, IDataStore current_img_storage)
 {
     using (var stream = current_img_storage.GetReadStream(domain, file_link))
     {
         attach.data = stream.GetCorrectBuffer();
     }
 }
开发者ID:Inzaghi2012,项目名称:teamlab.v7.5,代码行数:7,代码来源:MailSendItem.cs


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