Ejemplo n.º 1
0
 public StreamAsyncProcessor(StreamAlgorithm algorithm)
 {
     _algorithm = algorithm;
     for (int i = 0; i < 9; ++i)
     {
         _unitPool.Add(new StreamUnit(algorithm));
     }
 }
Ejemplo n.º 2
0
        public static IStreamAlgorithm CreateAlgorithm(StreamAlgorithm algorithm)
        {
            if (algorithm == StreamAlgorithm.GZip)
            {
                return(new GZipAlgorithm());
            }

            return(new NoZipAlgorithm());
        }
Ejemplo n.º 3
0
        public OCStreamer(bool multiThread = false, StreamAlgorithm algorithm = StreamAlgorithm.GZip)
        {
            _algorithm = algorithm;

            if (multiThread)
            {
                _streamProcessor = new StreamAsyncProcessor(algorithm);
            }
            else
            {
                _streamProcessor = new StreamSyncProcessor(algorithm);
            }
        }
Ejemplo n.º 4
0
 public StreamSyncProcessor(StreamAlgorithm algorithm)
 {
     _streamUnit = new StreamUnit(algorithm);
 }
Ejemplo n.º 5
0
 public StreamUnit(StreamAlgorithm algorithm)
 {
     _algorithm = StreamAlgorithmFactory.CreateAlgorithm(algorithm);
     _stats     = new StreamStats(algorithm);
     Busy       = false;
 }
Ejemplo n.º 6
0
 public StreamStats(StreamAlgorithm algorithm)
 {
     Algorithm      = algorithm;
     CompressTime   = 0;
     DecompressTime = 0;
 }