Compress() public method

지정된 스트림을 압축합니다.
public Compress ( Stream input ) : byte[]
input Stream
return byte[]
        public void Adaptor_Compress_Decompress_By_ByteArray_InParallel() {
            var plainBytes = PlainText.ToBytes();

            Parallel.ForEach(_compressors,
                             compressor => {
                                 var adapter = new CompressAdapter(compressor);

                                 var compressed = adapter.Compress(plainBytes);
                                 var recovery = adapter.Decompress(compressed);
                                 Assert.AreEqual(plainBytes, recovery);
                                 CollectionAssert.AreEqual(plainBytes, recovery);
                             });
        }
        public void Adaptor_Compress_Decompress_By_ByteArray_InParallel()
        {
            var plainBytes = PlainText.ToBytes();

            Parallel.ForEach(_compressors,
                             compressor => {
                var adapter = new CompressAdapter(compressor);

                var compressed = adapter.Compress(plainBytes);
                var recovery   = adapter.Decompress(compressed);
                Assert.AreEqual(plainBytes, recovery);
                CollectionAssert.AreEqual(plainBytes, recovery);
            });
        }
        public void Adaptor_Compress_Decompress_By_Stream_InParallel() {
            var plainStream = PlainText.ToStream();

            Parallel.ForEach(_compressors,
                             compressor => {
                                 var adapter = new CompressAdapter(compressor);

                                 var compressed = adapter.Compress(plainStream);
                                 var recoveryStream = new MemoryStream(compressed.Length * 2);
                                 adapter.Decompress(compressed, recoveryStream);

                                 // 데이터가 써졌으므로, 다시 원 위치로 설정해줘야 합니다.
                                 recoveryStream.SetStreamPosition();

                                 Assert.IsTrue(recoveryStream.Length > 0);
                                 Assert.AreEqual(PlainText, recoveryStream.ToText());
                             });
        }
        public void Adaptor_Compress_Decompress_By_Stream_InParallel()
        {
            var plainStream = PlainText.ToStream();

            Parallel.ForEach(_compressors,
                             compressor => {
                var adapter = new CompressAdapter(compressor);

                var compressed     = adapter.Compress(plainStream);
                var recoveryStream = new MemoryStream(compressed.Length * 2);
                adapter.Decompress(compressed, recoveryStream);

                // 데이터가 써졌으므로, 다시 원 위치로 설정해줘야 합니다.
                recoveryStream.SetStreamPosition();

                Assert.IsTrue(recoveryStream.Length > 0);
                Assert.AreEqual(PlainText, recoveryStream.ToText());
            });
        }