/// <inheritdoc/>
        public byte[] Read(IDataStorerEntry entry)
        {
            Validation.NotNull("Entry", entry);

            BinaryReadOnlyStorerEntry binaryEntry = entry as BinaryReadOnlyStorerEntry;

            if (binaryEntry == null)
            {
                throw new InvalidEntryException(entry.Path);
            }

            byte[] data  = null;
            int    count = (int)binaryEntry.CompressedSize;

            if (binaryEntry.CompressionMethod == CompressionMethod.Store)
            {
                data = new byte[count];
                Buffer.BlockCopy(this.binaryData, binaryEntry.FileOffset, data, 0, count);
            }
            else
            {
                data = ZLibUtils.Inflate(this.binaryData, binaryEntry.FileOffset, binaryEntry.CompressedSize);
            }

            return(data);
        }
        private void BinaryReadOnlyStorer_OneFile_Test(bool enableCompression)
        {
            IReadOnlyDataStorer       storer = BinaryReadOnlyStorer.FromData(enableCompression ? binaryOneFileDeflate : binaryOneFileStore);
            BinaryReadOnlyStorerEntry entry  = storer.Entries.FindOrDefault(e => e.Path == filePath1) as BinaryReadOnlyStorerEntry;

            Assert.NotNull(fileData.SequenceEqual(storer.Read(entry)));
        }
        private void BinaryReadOnlyStorer_OneFile_Test(bool enableCompression, Func <BinaryReadOnlyStorerEntry, object> selectValue, object value)
        {
            IReadOnlyDataStorer       storer = BinaryReadOnlyStorer.FromData(enableCompression ? binaryOneFileDeflate : binaryOneFileStore);
            BinaryReadOnlyStorerEntry entry  = storer.Entries.FindOrDefault(e => e.Path == filePath1) as BinaryReadOnlyStorerEntry;

            Assert.AreEqual(value, selectValue(entry));
        }
        private void BinaryReadOnlyStorer_TwoFiles_Test(bool enableCompression)
        {
            IReadOnlyDataStorer storer = BinaryReadOnlyStorer.FromData(enableCompression ? binaryTwoFilesDeflate : binaryTwoFilesStore);

            IReadOnlyList <IDataStorerEntry> entries = storer.Entries;
            BinaryReadOnlyStorerEntry        entry1  = entries.FindOrDefault(e => e.Path == filePath1) as BinaryReadOnlyStorerEntry;
            BinaryReadOnlyStorerEntry        entry2  = entries.FindOrDefault(e => e.Path == filePath2) as BinaryReadOnlyStorerEntry;

            Assert.NotNull(fileData.SequenceEqual(storer.Read(entry1)));
            Assert.NotNull(fileData.SequenceEqual(storer.Read(entry2)));
        }