async Tasks.Task <bool> FlushBuffer() { byte[] array; int count; lock (this.outBufferLock) { array = (byte[])this.outBuffer; count = this.outBuffer.Count; this.outBuffer = new Collection.Array.List <byte>(this.outBuffer.Capacity); } bool result; if (result = count > 0) { await this.stream.WriteAsync(array, 0, count); } return(result); }
public bool Flush() { byte[] array; int count; lock (this.outBufferLock) { array = (byte[])this.outBuffer; count = this.outBuffer.Count; this.outBuffer = new Collection.Array.List<byte>(this.outBuffer.Capacity); } bool result = this.stream.NotNull(); if (result && count > 0) { this.stream.Write(array, 0, count); this.stream.Flush(); } return result; }