Beispiel #1
0
        public void Decompress()
        {
            ReaderForDecompress Reader       = new ReaderForDecompress(inputFile, readBuffer, bufferSize, canceler);
            Decompressor        Decompressor = new Decompressor(readBuffer, writeBuffer, bufferSize, canceler);
            WriterForDecompress Writer       = new WriterForDecompress(outputFile, writeBuffer, canceler);

            ExecuteDecompress(Reader, Decompressor, Writer);
        }
Beispiel #2
0
        public void ExecuteDecompress(ReaderForDecompress Reader, Decompressor Decompressor, WriterForDecompress Writer)
        {
            Thread reader = new Thread(new ThreadStart(Reader.Read));

            reader.Start();

            Thread[] decompressor = new Thread[compressionThreads];
            for (int i = 0; i < compressionThreads; i++)
            {
                decompressor[i] = new Thread(new ParameterizedThreadStart(Decompressor.Decompress));
                decompressor[i].Start(i);
            }

            Thread writer = new Thread(new ThreadStart(Writer.Write));

            writer.Start();

            reader.Join();
            for (int i = 0; i < compressionThreads; i++)
            {
                decompressor[i].Join();
            }

            writeBuffer.Close();
            writer.Join();
        }