Esempio n. 1
0
        /// <summary>
        /// parses the database cache file and populates the specified lists and interval trees
        /// </summary>
        public DataStructures.PredictionCache Read(ushort refIndex)
        {
            var indexEntry = GetIndexEntry(refIndex);
            var bp         = new BlockStream.BlockPosition {
                FileOffset = indexEntry.FileOffset
            };

            _blockStream.SetBlockPosition(bp);
            return(DataStructures.PredictionCache.Read(_reader, _lut, indexEntry, FileHeader));
        }
        public Prediction[] GetPredictions(ushort refIndex)
        {
            var indexEntry = _indexEntries[refIndex];

            _blockStream.SetBlockPosition(indexEntry.FileOffset);

            var predictions = new Prediction[indexEntry.Count];

            for (var i = 0; i < indexEntry.Count; i++)
            {
                predictions[i] = Prediction.Read(_reader, Header.LookupTable);
            }

            return(predictions);
        }
Esempio n. 3
0
        // ReSharper disable once UnusedParameter.Local
        private static void ReadFromBlockStream(ICompressionAlgorithm compressionAlgorithm, MemoryStream ms, string expectedRandomString)
        {
            using (var blockStream = new BlockStream(compressionAlgorithm, ms, CompressionMode.Decompress))
                using (var reader = new ExtendedBinaryReader(blockStream))
                {
                    CheckWriteException(blockStream);

                    // grab the header
                    var header = GetHeader(blockStream, out var customHeader);
                    Assert.Equal(ExpectedGenomeAssembly, header.GenomeAssembly);

                    // sequential string check
                    CheckString(reader, expectedRandomString);
                    CheckString(reader, SmallString);
                    CheckString(reader, FinalString);

                    // random access string check
                    blockStream.SetBlockPosition(customHeader.DemoPosition);
                    CheckString(reader, SmallString);
                }
        }
Esempio n. 4
0
        // ReSharper disable once UnusedParameter.Local
        private static void ReadFromBlockStream(ICompressionAlgorithm compressionAlgorithm, Stream ms, string expectedRandomString)
        {
            // grab the header
            var header = DemoHeader.Read(ms);

            Assert.Equal(ExpectedAssembly, header.Assembly);

            using (var blockStream = new BlockStream(compressionAlgorithm, ms, CompressionMode.Decompress))
                using (var reader = new ExtendedBinaryReader(blockStream))
                {
                    CheckWriteException(blockStream);

                    // sequential string check
                    CheckString(reader, expectedRandomString);
                    CheckString(reader, SmallString);
                    CheckString(reader, FinalString);

                    // random access string check
                    blockStream.SetBlockPosition(header.Custom.FileOffset, header.Custom.InternalOffset);
                    //reader.Reset();

                    CheckString(reader, SmallString);
                }
        }