public StreamForwarderRepeatingTask(Stream sourceStream, Stream targetStream, byte[] buffer, IStreamAvailabilityChecker sourceStreamAvailabilityChecker,
            IStreamCompletionChecker sourceStreamCompletionChecker)
        {
            if (sourceStream == null)
                throw new ArgumentNullException("sourceStream");

            if (targetStream == null)
                throw new ArgumentNullException("targetStream");

            if (buffer == null)
                throw new ArgumentNullException("buffer");

            _sourceStream = sourceStream;
            _targetStream = targetStream;
            _buffer = buffer;
            _sourceStreamAvailabilityChecker = sourceStreamAvailabilityChecker;
            _sourceStreamCompletionChecker = sourceStreamCompletionChecker;
        }
Пример #2
0
        public StreamForwarder(Stream sourceStream, Stream targetStream, int bufferSize, 
            IStreamAvailabilityChecker sourceStreamAvailabilityChecker,
            IStreamCompletionChecker sourceStreamCompletionChecker,
            IInterruptibleRepeater interruptibleRepeater
        )
        {
            if (sourceStream == null)
                throw new ArgumentNullException("sourceStream");

            if (targetStream == null)
                throw new ArgumentNullException("targetStream");

            if (interruptibleRepeater == null)
                throw new ArgumentNullException("interruptibleRepeater");

            _sourceStream = sourceStream;
            _targetStream = targetStream;
            _bufferSize = bufferSize;
            _interruptibleRepeater = interruptibleRepeater;
            _sourceStreamAvailabilityChecker = sourceStreamAvailabilityChecker;
            _sourceStreamCompletionChecker = sourceStreamCompletionChecker;

            _buffer = new byte[bufferSize];
        }
        public StreamForwarderBuilder SetSourceStreamCompletionChecker(IStreamCompletionChecker value)
        {
            _sourceStreamCompletionChecker = value;

            return this;
        }