예제 #1
0
        public TOut DecryptDecompressDeserialize <TOut>(ReadOnlyMemory <byte> data)
        {
            var decryptedData    = _encryptionProvider.Decrypt(data);
            var decompressedData = _compressionProvider.Decompress(decryptedData);

            return(_serializationProvider.Deserialize <TOut>(decompressedData));
        }
예제 #2
0
        public void Decompress()
        {
            var decompressedData = _provider.Decompress(_compressedData).ToArray();

            Assert.NotNull(decompressedData);
            Assert.Equal(decompressedData.Length, _data.Length);
            Assert.Equal(decompressedData, _data);
        }
 public void RecyclableGzipProvider_10KBytes(int x)
 {
     for (var i = 0; i < x; i++)
     {
         var compressedData   = RecyclableProvider.Compress(Payload1);
         var decompressedData = RecyclableProvider.Decompress(compressedData);
     }
 }
예제 #4
0
 public void GzipProvider_5KBytes(int x)
 {
     for (var i = 0; i < x; i++)
     {
         var compressedData   = CompressionProvider.Compress(Payload1);
         var decompressedData = CompressionProvider.Decompress(compressedData);
     }
 }
예제 #5
0
        public void Deflate_CompressDecompress()
        {
            var compressed = _deflateProvider.Compress(_compressableData);

            Assert.NotNull(compressed);
            Assert.NotEqual(compressed.Length, _compressableData.Length);
            Assert.True(compressed.Length < _compressableData.Length);

            var decompressed = _deflateProvider.Decompress(compressed);

            Assert.NotNull(decompressed);
            Assert.Equal(decompressed.Length, _compressableData.Length);
            Assert.Equal(decompressed, _compressableData);
        }
예제 #6
0
        public void LZ4Stream_CompressDecompress()
        {
            var compressed = _lz4StreamProvider.Compress(_compressableData);

            Assert.NotNull(compressed);
            Assert.NotEqual(compressed.Length, _compressableData.Length);
            Assert.True(compressed.Length < _compressableData.Length);

            var decompressed = _lz4StreamProvider.Decompress(compressed);

            Assert.NotNull(decompressed);
            Assert.Equal(decompressed.Length, _compressableData.Length);
            Assert.Equal(decompressed, _compressableData);
        }
        public byte[] Read(Guid id, string filename)
        {
            Dictionary <string, string> metaData;

            byte[] data = storageProvider.Read(id, filename, out metaData);
            if (metaData.ContainsKey(EncryptionKey))
            {
                IEncryptionProvider encryptionProvider = Factory.GetEncryptionProvider((EncryptionProviderType)Enum.Parse(typeof(EncryptionProviderType), metaData[EncryptionKey]), configurationProvider);
                data = encryptionProvider.Decrypt(data);
            }
            if (metaData.ContainsKey(CompressionKey))
            {
                ICompressionProvider compressionProvider = Factory.GetCompressionProvider((CompressionProviderType)Enum.Parse(typeof(CompressionProviderType), metaData[CompressionKey]), configurationProvider);
                data = compressionProvider.Decompress(data);
            }
            return(data);
        }
예제 #8
0
        public void CompressToStream()
        {
            var compressedStream = _provider.CompressToStream(_data);
            var compressedData   = compressedStream.ToArray();

            var uncompressedData = _provider.Decompress(compressedData).ToArray();

            Assert.NotNull(compressedData);
            Assert.NotEqual(compressedData.Length, _data.Length);
            Assert.True(compressedData.Length < _data.Length);

            Assert.Equal(uncompressedData, _data);
        }
 public void Decompress5KBytes()
 {
     CompressionProvider.Decompress(CompressedPayload1);
 }