47 if ((uint)(num - 1) <= 2u)
81 if (bufferedFileStreamStrategy.
_readLen - bufferedFileStreamStrategy.
_readPos <= 0)
89 bufferedFileStreamStrategy._readPos += num2;
120 result2 = awaiter3.GetResult();
124 bufferedFileStreamStrategy._readPos = (bufferedFileStreamStrategy._readLen = 0);
125 if (bufferedFileStreamStrategy.
_writePos > 0)
140 bufferedFileStreamStrategy._writePos = 0;
146 if (!awaiter3.IsCompleted)
157 if (!awaiter2.IsCompleted)
166 int result3 = awaiter2.GetResult();
167 bufferedFileStreamStrategy._readLen = result3;
170 bufferedFileStreamStrategy._readPos += num2;
240 if ((uint)(num - 1) <= 1u)
280 if (bufferedFileStreamStrategy.
_writePos == 0)
284 if (bufferedFileStreamStrategy.
_writePos <= 0)
288 int num2 = bufferedFileStreamStrategy._bufferSize - bufferedFileStreamStrategy.
_writePos;
297 readOnlySpan = readOnlySpan.
Slice(0, num2);
299 bufferedFileStreamStrategy._writePos += num2;
343 bufferedFileStreamStrategy._writePos = 0;
431 _strategy.Position =
value;
495 protected override void Dispose(
bool disposing)
514 base.Dispose(disposing);
606 return valueTask.
AsTask();
608 return LastSyncCompletedReadTask(valueTask.
Result);
609 Task<int> LastSyncCompletedReadTask(
int val)
612 if (lastSyncCompletedReadTask !=
null && lastSyncCompletedReadTask.
Result == val)
614 return lastSyncCompletedReadTask;
681 [AsyncStateMachine(typeof(_003CReadAsyncSlowPath_003Ed__39))]
687 stateMachine._003C_003E4__this =
this;
688 stateMachine.semaphoreLockTask = semaphoreLockTask;
689 stateMachine.buffer =
buffer;
691 stateMachine._003C_003E1__state = -1;
738 if (arraySegment.
Array !=
null)
740 arraySegment = arraySegment.
Slice(num);
747 if (arraySegment.
Array !=
null)
756 else if (
source.Length != 0)
852 [AsyncStateMachine(typeof(_003CWriteAsyncSlowPath_003Ed__50))]
858 stateMachine._003C_003E4__this =
this;
859 stateMachine.semaphoreLockTask = semaphoreLockTask;
860 stateMachine.source =
source;
862 stateMachine._003C_003E1__state = -1;
885 Flush(flushToDisk:
false);
888 internal override void Flush(
bool flushToDisk)
1007 long num2 = num - (position -
_readPos);
1090 [MemberNotNull(
"_buffer")]
1100 [MemberNotNull(
"_buffer")]
override void CopyTo(Stream destination, int bufferSize)
override async ValueTask DisposeAsync()
void EnsureBufferAllocated()
override int Read(Span< byte > destination)
override int Read(byte[] buffer, int offset, int count)
override int EndRead(IAsyncResult asyncResult)
void ClearReadBufferBeforeWrite()
void WriteSpan(ReadOnlySpan< byte > source, ArraySegment< byte > arraySegment)
override Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
async Task CopyToAsyncCore(Stream destination, int bufferSize, CancellationToken cancellationToken)
override void EndWrite(IAsyncResult asyncResult)
override void Write(ReadOnlySpan< byte > buffer)
override void Lock(long position, long length)
Task< int > _lastSyncCompletedReadTask
int ReadSpan(Span< byte > destination, ArraySegment< byte > arraySegment)
override ValueTask< int > ReadAsync(Memory< byte > buffer, CancellationToken cancellationToken=default(CancellationToken))
override void SetLength(long value)
override long Seek(long offset, SeekOrigin origin)
async ValueTask WriteToNonSeekableAsync(ReadOnlyMemory< byte > source, CancellationToken cancellationToken)
override Task FlushAsync(CancellationToken cancellationToken)
override void DisposeInternal(bool disposing)
ValueTask WriteAsyncSlowPath(Task semaphoreLockTask, ReadOnlyMemory< byte > source, CancellationToken cancellationToken)
BufferedFileStreamStrategy(FileStreamStrategy strategy, int bufferSize)
override void Dispose(bool disposing)
override Task< int > ReadAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
readonly FileStreamStrategy _strategy
override Task CopyToAsync(Stream destination, int bufferSize, CancellationToken cancellationToken)
override ValueTask WriteAsync(ReadOnlyMemory< byte > buffer, CancellationToken cancellationToken=default(CancellationToken))
~BufferedFileStreamStrategy()
ValueTask< int > ReadAsyncSlowPath(Task semaphoreLockTask, Memory< byte > buffer, CancellationToken cancellationToken)
async Task FlushAsyncInternal(CancellationToken cancellationToken)
override IAsyncResult BeginRead(byte[] buffer, int offset, int count, AsyncCallback callback, object state)
override void Flush(bool flushToDisk)
override IAsyncResult BeginWrite(byte[] buffer, int offset, int count, AsyncCallback callback, object state)
override void Write(byte[] buffer, int offset, int count)
void WriteByteSlow(byte value)
override void WriteByte(byte value)
async ValueTask< int > ReadFromNonSeekableAsync(Memory< byte > destination, CancellationToken cancellationToken)
override void Unlock(long position, long length)
static bool IsIoRelatedException(Exception e)
void Unlock(long position, long length)
void Flush(bool flushToDisk)
void Lock(long position, long length)
SafeFileHandle SafeFileHandle
void SetLength(long value)
long Seek(long offset, SeekOrigin origin)
Task WriteAsync(byte[] buffer, int offset, int count)
int Read(byte[] buffer, int offset, int count)
void CopyTo(Stream destination)
Task< int > ReadAsync(byte[] buffer, int offset, int count)
SemaphoreSlim _asyncActiveSemaphore
void Write(byte[] buffer, int offset, int count)
Task CopyToAsync(Stream destination)
SemaphoreSlim EnsureAsyncActiveSemaphoreInitialized()
virtual ValueTask DisposeAsync()
static byte Min(byte val1, byte val2)
static int CompareExchange(ref int location1, int value, int comparand)
static IAsyncResult Begin(Task task, AsyncCallback callback, object state)
static void End(IAsyncResult asyncResult)
new ConfiguredTaskAwaitable< TResult > ConfigureAwait(bool continueOnCapturedContext)
static Task FromCanceled(CancellationToken cancellationToken)
static void ThrowNotSupportedException_UnwritableStream()
static void ThrowNotSupportedException_UnseekableStream()
static void ThrowObjectDisposedException_StreamClosed(string objectName)
static void ThrowNotSupportedException_UnreadableStream()
void SetStateMachine(IAsyncStateMachine stateMachine)
ArraySegment< T > Slice(int index)
ConfiguredValueTaskAwaitable< int >.ConfiguredValueTaskAwaiter _003C_003Eu__3
ConfiguredValueTaskAwaitable.ConfiguredValueTaskAwaiter _003C_003Eu__2
void SetStateMachine(IAsyncStateMachine stateMachine)
BufferedFileStreamStrategy _003C_003E4__this
CancellationToken cancellationToken
PoolingAsyncValueTaskMethodBuilder< int > _003C_003Et__builder
ConfiguredTaskAwaitable.ConfiguredTaskAwaiter _003C_003Eu__1
int _003CbytesAlreadySatisfied_003E5__2
ConfiguredTaskAwaitable.ConfiguredTaskAwaiter _003C_003Eu__1
PoolingAsyncValueTaskMethodBuilder _003C_003Et__builder
ReadOnlyMemory< byte > source
void SetStateMachine(IAsyncStateMachine stateMachine)
BufferedFileStreamStrategy _003C_003E4__this
CancellationToken cancellationToken
ConfiguredValueTaskAwaitable.ConfiguredValueTaskAwaiter _003C_003Eu__2
Memory< T > Slice(int start)
unsafe ReadOnlySpan< T > Span
ReadOnlyMemory< T > Slice(int start)
void CopyTo(Span< T > destination)
ReadOnlySpan< T > Slice(int start)
void SetException(Exception exception)
void SetStateMachine(IAsyncStateMachine stateMachine)
static PoolingAsyncValueTaskMethodBuilder Create()
void CopyTo(Span< T > destination)
static CancellationToken None
static ValueTask FromCanceled(CancellationToken cancellationToken)
bool IsCompletedSuccessfully
ConfiguredValueTaskAwaitable ConfigureAwait(bool continueOnCapturedContext)