Exemplo n.º 1
0
        public int[] DecodeToArray(long bitsToRead, IBitReader bitReader)
        {
            this.bitsToRead = bitsToRead;
            this.bitReader  = bitReader;
            InitializeModel();

            InitializeCodeWithTheFirst32Bits();
            var values = new List <int>();

            while (true)
            {
                var decodedSymbolIndex = DecodeNextSymbol();
                var decodedSymbol      = alphabet[decodedSymbolIndex];

                if (decodedSymbol == endOfFileSymbol)
                {
                    break;
                }

                values.Add(decodedSymbol);

                UpdateModel(decodedSymbolIndex);
            }

            bitReader.Dispose();

            return(values.ToArray());
        }
Exemplo n.º 2
0
        public void Dispose()
        {
            if (bitReader != null)
            {
                bitReader.Dispose();
            }

            if (bitWriter != null)
            {
                bitWriter.Dispose();
            }
        }
        public void TestThatDisposeCallsInputStreamCloseOnce()
        {
            bitReader.Dispose();

            inputStreamMock.Verify(x => x.Close(), Times.Once);
        }