diff options
Diffstat (limited to 'src/System.Private.CoreLib/shared/System/IO/FileStream.cs')
-rw-r--r-- | src/System.Private.CoreLib/shared/System/IO/FileStream.cs | 33 |
1 files changed, 13 insertions, 20 deletions
diff --git a/src/System.Private.CoreLib/shared/System/IO/FileStream.cs b/src/System.Private.CoreLib/shared/System/IO/FileStream.cs index 717b73ff1..fadbef880 100644 --- a/src/System.Private.CoreLib/shared/System/IO/FileStream.cs +++ b/src/System.Private.CoreLib/shared/System/IO/FileStream.cs @@ -6,7 +6,6 @@ using System.Threading; using System.Threading.Tasks; using Microsoft.Win32.SafeHandles; using System.Diagnostics; -using System.Security; namespace System.IO { @@ -233,7 +232,7 @@ namespace System.IO try { - Init(mode, share); + Init(mode, share, path); } catch { @@ -245,12 +244,6 @@ namespace System.IO } } - private static bool GetDefaultIsAsync(SafeFileHandle handle) - { - // This will eventually get more complicated as we can actually check the underlying handle type on Windows - return handle.IsAsync.HasValue ? handle.IsAsync.Value : false; - } - [Obsolete("This property has been deprecated. Please use FileStream's SafeFileHandle property instead. http://go.microsoft.com/fwlink/?linkid=14202")] public virtual IntPtr Handle { get { return SafeFileHandle.DangerousGetHandle(); } } @@ -304,7 +297,7 @@ namespace System.IO ReadSpan(new Span<byte>(array, offset, count)); } - public override int Read(Span<byte> destination) + public override int Read(Span<byte> buffer) { if (GetType() == typeof(FileStream) && !_useAsyncIO) { @@ -312,7 +305,7 @@ namespace System.IO { throw Error.GetFileNotOpen(); } - return ReadSpan(destination); + return ReadSpan(buffer); } else { @@ -322,7 +315,7 @@ namespace System.IO // of Read(byte[],int,int) overload. Or if the stream is in async mode, we can't call the // synchronous ReadSpan, so we similarly call the base Read, which will turn delegate to // Read(byte[],int,int), which will do the right thing if we're in async mode. - return base.Read(destination); + return base.Read(buffer); } } @@ -355,14 +348,14 @@ namespace System.IO return ReadAsyncTask(buffer, offset, count, cancellationToken); } - public override ValueTask<int> ReadAsync(Memory<byte> destination, CancellationToken cancellationToken = default(CancellationToken)) + public override ValueTask<int> ReadAsync(Memory<byte> buffer, CancellationToken cancellationToken = default) { if (!_useAsyncIO || GetType() != typeof(FileStream)) { // If we're not using async I/O, delegate to the base, which will queue a call to Read. // Or if this isn't a concrete FileStream, a derived type may have overridden ReadAsync(byte[],...), // which was introduced first, so delegate to the base which will delegate to that. - return base.ReadAsync(destination, cancellationToken); + return base.ReadAsync(buffer, cancellationToken); } if (cancellationToken.IsCancellationRequested) @@ -375,7 +368,7 @@ namespace System.IO throw Error.GetFileNotOpen(); } - Task<int> t = ReadAsyncInternal(destination, cancellationToken, out int synchronousResult); + Task<int> t = ReadAsyncInternal(buffer, cancellationToken, out int synchronousResult); return t != null ? new ValueTask<int>(t) : new ValueTask<int>(synchronousResult); @@ -412,7 +405,7 @@ namespace System.IO } } - public override void Write(ReadOnlySpan<byte> destination) + public override void Write(ReadOnlySpan<byte> buffer) { if (GetType() == typeof(FileStream) && !_useAsyncIO) { @@ -420,7 +413,7 @@ namespace System.IO { throw Error.GetFileNotOpen(); } - WriteSpan(destination); + WriteSpan(buffer); } else { @@ -430,7 +423,7 @@ namespace System.IO // of Write(byte[],int,int) overload. Or if the stream is in async mode, we can't call the // synchronous WriteSpan, so we similarly call the base Write, which will turn delegate to // Write(byte[],int,int), which will do the right thing if we're in async mode. - base.Write(destination); + base.Write(buffer); } } @@ -461,14 +454,14 @@ namespace System.IO return WriteAsyncInternal(new ReadOnlyMemory<byte>(buffer, offset, count), cancellationToken).AsTask(); } - public override ValueTask WriteAsync(ReadOnlyMemory<byte> source, CancellationToken cancellationToken = default(CancellationToken)) + public override ValueTask WriteAsync(ReadOnlyMemory<byte> buffer, CancellationToken cancellationToken = default) { if (!_useAsyncIO || GetType() != typeof(FileStream)) { // If we're not using async I/O, delegate to the base, which will queue a call to Write. // Or if this isn't a concrete FileStream, a derived type may have overridden WriteAsync(byte[],...), // which was introduced first, so delegate to the base which will delegate to that. - return base.WriteAsync(source, cancellationToken); + return base.WriteAsync(buffer, cancellationToken); } if (cancellationToken.IsCancellationRequested) @@ -481,7 +474,7 @@ namespace System.IO throw Error.GetFileNotOpen(); } - return WriteAsyncInternal(source, cancellationToken); + return WriteAsyncInternal(buffer, cancellationToken); } /// <summary> |