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


C# System.IO.Compression.GZipStream.CopyTo方法代码示例

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


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

示例1: Decode

 /// <summary>
 /// Decode the content
 /// </summary>
 /// <param name="data">Content to decode</param>
 /// <returns>Decoded content</returns>
 public byte[] Decode(byte[] data)
 {
     var output = new MemoryStream();
     var input = new MemoryStream(data);
     using (var stream = new System.IO.Compression.GZipStream(input, System.IO.Compression.CompressionMode.Decompress))
         stream.CopyTo(output);
     return output.ToArray();
 }
开发者ID:changsunfung,项目名称:RestSharp.Portable,代码行数:13,代码来源:GzipEncoding.cs

示例2: GetObjectResponse

        internal dynamic GetObjectResponse(IInternetServiceListener Listener = null)
        {
            IHttpWebResponse response = GetResponse(Listener);
            if (response == null)
                return null;

            HttpStatusCode sc = response.StatusCode;

            if (sc != HttpStatusCode.OK)
            {
                if (Listener != null)
                    Listener.OnStatusCodeKO(sc);

                return null;
            }

            Stream readStream = response.GetResponseStream();
            if (readStream == null)
            {
                if (Listener != null)
                    Listener.OnUnExpectedUnreadableResult();

                return null;
            }

            Stream toberead = null;

            if (response.ContentEncoding == "gzip")
            {
                toberead = new MemoryStream();

                using (Stream unzip = new System.IO.Compression.GZipStream(readStream, System.IO.Compression.CompressionMode.Decompress))
                {
                    unzip.CopyTo(toberead); 
                }

                toberead.Position = 0;
                readStream.Dispose();
            }
            else
                toberead = readStream;


            string sr = null;
            using (toberead)
            {
                using (StreamReader reader = new StreamReader(toberead))
                {
                    sr = reader.ReadToEnd();
                }

            }

            return DynamicJsonConverter.DynamicDeSerialize(sr);
        }
开发者ID:David-Desmaisons,项目名称:MusicCollection,代码行数:55,代码来源:HttpJsonInterpretor.cs

示例3: Decompress

        /// <summary>
        /// Decompress data using GZip
        /// </summary>
        /// <param name="dataToDecompress">The stream that hold the data</param>
        /// <returns>Bytes array of decompressed data</returns>
        public static byte[] Decompress(Stream dataToDecompress)
        {
            MemoryStream target = new MemoryStream();

            using (System.IO.Compression.GZipStream decompressionStream = new System.IO.Compression.GZipStream(dataToDecompress,
                System.IO.Compression.CompressionMode.Decompress))
            {
                decompressionStream.CopyTo(target);
            }
            return target.GetBuffer();

        }
开发者ID:t-andre,项目名称:Emby,代码行数:17,代码来源:Utilities.cs

示例4: PushFile

        internal static decimal PushFile(File f)
        {
            HashSet<File> current = GetCurrentFileList();

            File serverFile = current.FirstOrDefault(find => find.fullPath == f.fullPath);

            // un gzip
            if ((f.content != null) && (f.content.Length > 0))
            {
                System.IO.MemoryStream mOut = new System.IO.MemoryStream();

                using (System.IO.MemoryStream ms = new System.IO.MemoryStream(f.content))
                {
                    using (System.IO.Compression.GZipStream compressed = new System.IO.Compression.GZipStream(ms, System.IO.Compression.CompressionMode.Decompress))
                    {
                        compressed.CopyTo(mOut);
                    }

                    f.content = mOut.ToArray();
                }
            }



            if (f.content == null)
            {
                System.IO.File.Delete(@"C:\dsencloudserver" + f.fullPath);
            }
            else if (serverFile == null)
            {
                System.IO.File.WriteAllBytes(@"C:\dsencloudserver" + f.fullPath, f.content);
                return f.version + 1;
            }
            else if (serverFile.version == f.version)
            {
                 System.IO.File.WriteAllBytes(@"C:\dsencloudserver" + f.fullPath, f.content);
                return f.version + 1;
            }

          
            return -1;           
        }
开发者ID:andrewleith,项目名称:OrangeCloudSyncClient,代码行数:42,代码来源:MockServer.cs

示例5: using

private static byte[]zs(byte[]o){using(var c=new System.IO.MemoryStream(o))
                                 using(var z=new System.IO.Compression.GZipStream(c,System.IO.Compression.CompressionMode.Decompress))
                                 using(var r=new System.IO.MemoryStream()){z.CopyTo(r);return r.ToArray();}}
开发者ID:Mikescher,项目名称:Project-Euler_Befunge,代码行数:3,代码来源:Euler_Problem-047.cs

示例6: SetData

        public void SetData(string str, string scv, byte[] dealsInfo, byte[] dealsData)
        {
            this.CurrentTestRet = WekaUtils.StringToDoubleArray(str);
            this.CurrentClassValue = WekaUtils.StringToDoubleArray(scv);

            var deals = Feng.Windows.Utils.SerializeHelper.Deserialize<DealsInfo>(dealsInfo);
            if (dealsData != null)
            {
                System.IO.MemoryStream outStream = new System.IO.MemoryStream();
                var inStream = new System.IO.MemoryStream(dealsData);
                System.IO.Compression.GZipStream zipStream = new System.IO.Compression.GZipStream(inStream, System.IO.Compression.CompressionMode.Decompress);
                zipStream.CopyTo(outStream);

                deals.Deals = Feng.Windows.Utils.SerializeHelper.Deserialize<List<DealInfo>>(outStream.ToArray());
            }
            else
            {
                deals.Deals = new List<DealInfo>();
            }
            if (deals != null)
            {
                this.Deals = deals;
                Initialized = true;
            }
        }
开发者ID:wushian,项目名称:MLEA,代码行数:25,代码来源:CandidateClassifier.cs

示例7: DecompressStream

 private static void DecompressStream(System.IO.Stream inFile, System.IO.Stream outFile)
 {
     using (System.IO.Compression.GZipStream Decompress = new System.IO.Compression.GZipStream(inFile, System.IO.Compression.CompressionMode.Decompress, true))
     {
         // Copy the decompression stream 
         // into the output file.
         Decompress.CopyTo(outFile);
     }
 }
开发者ID:jira-sarec,项目名称:ICSE-2012-TraceLab,代码行数:9,代码来源:PackageFile.cs

示例8: DecompressGz

        /// <summary>
        /// Returns the data decompressed using Gzip.
        /// </summary>
        /// <param name='data'>
        /// The data to be decompressed.
        /// </param>
        private static System.IO.Stream DecompressGz(System.IO.Stream data)
        {
            System.IO.Compression.GZipStream gz = new System.IO.Compression.GZipStream(data, System.IO.Compression.CompressionMode.Decompress);
            TempFileStream tfs = new TempFileStream();

            gz.CopyTo(tfs);
            tfs.Seek(0, System.IO.SeekOrigin.Begin);

            return tfs;
        }
开发者ID:flan,项目名称:media-storage,代码行数:16,代码来源:Compression.cs

示例9: Encode

 public override byte[] Encode(byte[] Input)
 {
     System.IO.Compression.GZipStream gzs = new System.IO.Compression.GZipStream (new System.IO.MemoryStream (Input), System.IO.Compression.CompressionMode.Compress);
     System.IO.MemoryStream RMS/*i didn't mean it, it happend*/ = new System.IO.MemoryStream (Input.Length >> 1);
     RMS.WriteByte (0);
     gzs.CopyTo (RMS);
     return RMS.ToArray ();
 }
开发者ID:vebin,项目名称:BD2,代码行数:8,代码来源:compressv1.cs

示例10: Decode

 public override byte[] Decode(byte[] Input)
 {
     switch (Input [0]) {
     case 0:
         System.IO.Compression.GZipStream gzs = new System.IO.Compression.GZipStream (new System.IO.MemoryStream (Input, 1, Input.Length - 1), System.IO.Compression.CompressionMode.Decompress);
         System.IO.MemoryStream rms/*i didn't mean it, it happend*/ = new System.IO.MemoryStream (Input.Length * 3);
         gzs.CopyTo (rms);
         return rms.ToArray ();
     default:
         throw new NotSupportedException ("Invalid/Unsupported compression algorithm.");
     }
 }
开发者ID:vebin,项目名称:BD2,代码行数:12,代码来源:compressv1.cs

示例11: gzd

 public static string gzd(byte[] input)
 {
     using (var msi = new MemoryStream(input))
     {
         using (var gz = new System.IO.Compression.GZipStream(msi, System.IO.Compression.CompressionMode.Decompress))
         {
             using (var mso = new MemoryStream())
             {
                 gz.CopyTo(mso);
                 gz.Close();
                 byte[] bytes = mso.ToArray();
                 return Encoding.UTF8.GetString(bytes);
             }
         }
     }
 }
开发者ID:9001,项目名称:Loopstream,代码行数:16,代码来源:Z.cs


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