public StreamCopyToFactory(Stream source, StreamNativeAsyncFactory factory)
        {
            if (source == null)
            {
                throw new ArgumentNullException(nameof(source));
            }

            this.source = source;

            readAsync = factory.CreateReadAsyncMethod();
        }
Ejemplo n.º 2
0
            public ContingentAsyncMethods(Stream stream)
            {
                var factory = new StreamNativeAsyncFactory(stream, false);

                flushAsync = factory.CreateFlushAsyncMethod();
                readAsync  = factory.CreateReadAsyncMethod();
                writeAsync = factory.CreateWriteAsyncMethod();

                var copyToFactory = new StreamCopyToFactory(stream, factory);

                copyTo = copyToFactory.CreateStreamCopyToMethod();
                copyToWithCustomBufferSize = copyToFactory.CreateStreamCopyToWithCustomBufferSizeMethod();
                copyToAsync = copyToFactory.CreateStreamCopyToAsyncMethod();
                copyToAsyncWithCustomBufferSize = copyToFactory.CreateStreamCopyToAsyncWithCustomBufferSizeMethod();
            }