コード例 #1
0
        private static Stream GetCompressStream()
        {
            var stream         = OrginolStream();
            var compressStream = CompressManager.CompressStream(stream);

            return(compressStream);
        }
コード例 #2
0
        private static byte[] GetCompressedStream(string sourceText, Encoding encoding)
        {
            using (MemoryStream ms = new MemoryStream())
            {
                using (StreamWriter writer = new StreamWriter(ms, encoding))
                {
                    writer.Write(sourceText);
                    writer.Flush();

                    ms.Seek(0, SeekOrigin.Begin);

                    MemoryStream compressedStream = (MemoryStream)CompressManager.CompressStream(ms);

                    return(compressedStream.ToArray());
                }
            }
        }